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

Christian Loos cloos at netcologne.de
Tue Mar 10 06:28:40 EDT 2015


@Alex:
CreateTickets support both, CustomField and CF keys [1].

@Landon:
Why don't you simply add this lines to you template, as you are using a
static customfield list and don't want to add all customfields (assuming
you customfields are single value fields):

CF-Customfield1: {$Tickets{'TOP'}->FirstCustomFieldValue('Customfield1')}
CF-Customfield2: {$Tickets{'TOP'}->FirstCustomFieldValue('Customfield2')}
CF-etc: {$Ticket{'TOP'}->FirstCustomFieldValue('etc')}

Chris

[1]
https://github.com/bestpractical/rt/blob/stable/lib/RT/Action/CreateTickets.pm#L223-224

Am 10.03.2015 um 10:29 schrieb Alex Peters:
> 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
> <mailto: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 <mailto: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
> 




More information about the rt-users mailing list