[rt-users] Set Custom field in template
Jon Witts
jwitts at queenmargarets.com
Tue Mar 4 06:13:57 EST 2014
Hi all,
I am trying to use a template to set a ticket custom field so that we can configure RT to send out reminders when a ticket has been stalled for a week. We are running RT 4.2.0
The command I am passing to rt-crontool is as follows:
------------------------------------
rt-crontool --search RT::Search::FromSQL --search-arg "Queue = 'Estate' AND Subject LIKE 'email'" --action RT::Action::Notify --action-arg 'All' --template 'Auto-Close Warning HTML' --verbose
-------------------------------------
and the contents of the template "Auto-Close Warning HTML" is as follows:
--------------------------------------
my $CFName = 'Auto-Close Reminder';
my $DefaultValue = 'TRUE';
unless( $self->Ticket->FirstCustomFieldValue( $CFName ) eq $DefaultValue ) {
my( $st, $msg ) = $self->Ticket->AddCustomFieldValue(
Field => $CFName,
Value => $DefaultValue,
RecordTransaction => 1 );
}
Subject: Auto-Close Warning: {$Ticket->Subject}
Content-Type: text/html
<p>Hello,</p>
<p>This message has been automatically generated to let you know that your support request regarding "<b>{$Ticket->Subject()}</b>",
has been in a "stalled" state awaiting further information from yourself for a week. This ticket was assigned an ID of "<b>{$Ticket->SubjectTag}</b>".</p>
<p>If you do not respond with the requested information within 7 days then we will assume that this support request is no longer required and automatically close this request.</p>
<p>You may reply to this message to provide us with the required information, or you can visit the helpdesk to see all of your current support requests here: </p>
<p>Thank you,<br/>
{$Ticket->QueueObj->CorrespondAddress()}</p>
----------------------------------
This is giving me the following error:
-----------------------------------
[error]: Template parsing error: Can't call method "Ticket" on an undefined value at template line 5. (/opt/rt4/bin/../lib/RT/Template.pm:542)
-----------------------------------
My Perl is very basic (to say the least!) and I have pulled this code together from searching around. Could anyone on the list highlight where I am going wrong?
Thanks,
Jon
-----------------------------------------------------
Jon Witts
Director of Digital Strategy
Queen Margaret's School
Escrick Park
York YO19 6EU
Telephone: 01904 727600
Fax: 01904 728150
Website: www.queenmargarets.com
This email has been processed by Smoothwall Anti-Spam - www.smoothwall.net
More information about the rt-users
mailing list