[rt-users] Custom Fields in Scripts and Templates

Kenneth Crocker kfcrocker at lbl.gov
Thu Aug 12 15:45:36 EDT 2010

To "Whomever",

I use this code for user-defined "conditions" on Transactions:

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;

if  ($trans->Type eq 'CustomField')
    {my $cf = new RT::CustomField($RT::SystemUser);
        $cf->LoadByName(Queue => $ticket->QueueObj->id,
         Name => "Review Process");
     return 0 unless $cf->id;
     if  ($trans->Field == $cf->id &&
          $trans->NewValue eq "Review Complete-Approved")
           return 1;

return 0;

And I use this code for getting the value of a Custom Field from a ticket:

my $cf_value = $ticket->FirstCustomFieldValue('name of CF');

And I use this code to get that same value into a Template:

QA Approved by: {$Ticket->FirstCustomFieldValue('QA Approver')}

Hope this helps.


On Wed, Aug 11, 2010 at 12:08 PM, Sysadmin <Sysadmin at ruralnetwork.net>wrote:

> What is the correct syntax for inserting custom field data into scripts and
> templates? We have a service queue with a custom field (type of ticket =
> locate or repair).
> So, I want to create a script to read the type of ticket then dispatch an
> email with custom field data inserted in the email i.e. Service # Account#
> etc.
> Thanks,
> David
> System Admin
> RT Training in Washington DC, USA on Oct 25 & 26 2010
> Last one this year -- Learn how to get the most out of RT!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100812/c16823c7/attachment.htm>

More information about the rt-users mailing list