[rt-users] The use of $Ticket{'TOP'}->CustomFieldValues($fieldname) with RT::Action::CreateTickets

Alex Peters alex at peters.net
Tue Mar 10 05:29:15 EDT 2015


You need to output "CustomField-$cfname" as the key, not "CF-$cfname".

On Tue, 10 Mar 2015 6:31 pm Landon Stewart <lstewart at iweb.com> wrote:

> Hello,
>
> It seems that one cannot load the values of a CF with
> $Ticket{'TOP'}->CustomFieldValues($fieldname).  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).
>
> ===Create-Ticket: Investigation
> {
>   my @cflist = [ 'Customfield1', 'Customfield2', 'etc'];
>   our @CFTEXT;
>   foreach my $cfname (@cflist) {
>     RT::Logger->info($cfname);
>     my $cfvs = $Tickets{"TOP"}->CustomFieldValues($cfname);
>     while (my $cfv = $cfvs->Next) {
>       RT::Logger->info($cfname.": ".$cfv->Content);
>       push @CFTEXT, "CF-".$cfname.": ".$cfv->Content;
>     }
>   }
> }
> Queue: Investigations
> Parents: TOP
> Status: open
> { join("\n", @CFTEXT) }
> Content-Type: text/html
> Content:<pre>{$Tickets{"TOP"}->Transactions->First->Content}</pre>
> ENDOFCONTENT
>
> LOGS from the foreach() (but not from the while()):
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer ID (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Language (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Name (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Email (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Email Tech (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Status (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Service Type (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Service Status (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Name (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Status (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device O/S (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Control Panel
> (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer DBID (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Country (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Created (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Closed (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Groups (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Ticket Priority
> (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer Managed (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Customer SystemDB (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Service DBID (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Service Price (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Service Created (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Service Closed (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device DBID (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Created (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Closed (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Type (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Facility (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Bits (template:8)
> [16779] [Tue Mar 10 06:52:53 2015] [info]: Device Addresses (template:8)
>
>
>
> I've also tried loading the CF using
> $Tickets{"TOP"}->LoadCustomFieldByIdentifier($cfname) but this does not
> work either.
>
> Basically I'm waning to copy a list of CFs from $Tickets{'TOP'} to the
> newly created one.
>
> Thank you.
>
> Landon Stewart : lstewart at iweb.com
> Lead Specialist, Abuse and Security Management
> Spécialiste principal, gestion des abus et sécurité
> http://iweb.com : +1 (888) 909-4932
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150310/811fb3bf/attachment.htm>


More information about the rt-users mailing list