<p dir="ltr">You need to output "CustomField-$cfname" as the key, not "CF-$cfname".</p>
<br><div class="gmail_quote">On Tue, 10 Mar 2015 6:31 pm Landon Stewart <<a href="mailto:lstewart@iweb.com">lstewart@iweb.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hello,</div><div><br></div><div>It seems that one cannot load the values of a CF with <font face="Courier New">$Ticket{'TOP'}->CustomFieldValues($fieldname)</font>. The result is an empty variable. I've confirmed that the foreach works for each of the $cfname in the @cflist since I get log entries for them but $cfvs->Next doesn't produce a value (nothing is logged).</div><div><br></div><div><div><font face="Courier New">===Create-Ticket: Investigation</font></div><div><font face="Courier New">{</font></div><div><font face="Courier New"> my @cflist = [ 'Customfield1', 'Customfield2', 'etc'];</font></div><div><font face="Courier New"> our @CFTEXT;</font></div><div><font face="Courier New"> foreach my $cfname (@cflist) {</font></div><div><span style="font-family:'Courier New'"> RT::Logger->info($cfname);</span></div><div><font face="Courier New"> my $cfvs = $Tickets{"TOP"}->CustomFieldValues($cfname);</font></div><div><font face="Courier New"> while (my $cfv = $cfvs->Next) {</font></div><div><font face="Courier New"> RT::Logger->info($cfname.": ".$cfv->Content);</font></div><div><font face="Courier New"> push @CFTEXT, "CF-".$cfname.": ".$cfv->Content;</font></div><div><font face="Courier New"> }</font></div><div><font face="Courier New"> }</font></div><div><font face="Courier New">}</font></div><div><font face="Courier New">Queue: Investigations</font></div><div><font face="Courier New">Parents: TOP</font></div><div><font face="Courier New">Status: open</font></div><div><font face="Courier New">{ join("\n", @CFTEXT) }</font></div><div><font face="Courier New">Content-Type: text/html</font></div><div><font face="Courier New">Content:<pre>{$Tickets{"TOP"}->Transactions->First->Content}</pre></font></div><div><font face="Courier New">ENDOFCONTENT</font></div></div><div><br></div><div>LOGS from the <font face="Courier New">foreach()</font> (but not from the <font face="Courier New">while()</font>):</div><div><font face="Courier New">[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer ID (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Language (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Name (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Email (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Email Tech (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Status (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Service Type (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Service Status (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Name (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Status (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device O/S (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Control Panel (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer DBID (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Country (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Created (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Closed (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Groups (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Ticket Priority (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Managed (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Customer SystemDB (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Service DBID (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Service Price (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Service Created (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Service Closed (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device DBID (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Created (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Closed (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Type (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Facility (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Bits (template:8)<br>[16779] [Tue Mar 10 06:52:53 2015] [info]: Device Addresses (template:8)</font></div><div><br></div><div><br></div><div><br></div><div>I've also tried loading the CF using<font face="Courier New"> $Tickets{"TOP"}->LoadCustomFieldByIdentifier($cfname)</font> but this does not work either.</div><div><br></div><div>Basically I'm waning to copy a list of CFs from $Tickets{'TOP'} to the newly created one.</div><div><br></div><div>Thank you.</div><br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">Landon Stewart : <a href="mailto:lstewart@iweb.com" target="_blank">lstewart@iweb.com</a></div><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">Lead Specialist, Abuse and Security Management<br>Spécialiste principal, gestion des abus et sécurité<br><a href="http://iweb.com" target="_blank">http://iweb.com</a> : +1 (888) 909-4932</div></div>
</div>
<br></div></blockquote></div>