Hi Jim, I have edited my template code to this:
Subject: Auto-Close Warning: {$Ticket->Subject} Content-Type: text/html <!--{$Ticket->AddCustomFieldValue(Field => 'Auto-Close Reminder', Value => 'TRUE', RecordTransaction => 1 );}--> <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> Which now works; but only when the search from rt-crontool returns just one ticket. If the search returns more than one ticket then only the first ticket has it's CF changed, all others remain the same. The email is sent for the other tickets however... What do I need to do so that the template runs this setting CF code for each ticket in the search? Many 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 ---------------------------------------- On 3/4/14 6:13 AM, Jon Witts wrote: > 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} I think your issue is after the 'unless' where you're calling Ticket on $self. In templates the ticket object is available as just $Ticket as in the Subject line above. Try switching your $self->Ticket to $Ticket anywhere you're calling $self in the template. More docs on templates are available here: http://bestpractical.com/docs/rt/latest/customizing/templates.html You'll also need to put that initial code in some curly braces { } inside the template. More info here: https://metacpan.org/pod/Text::Template -- This email has been processed by Smoothwall Anti-Spam - www.smoothwall.net -- RT Training London, March 19-20 and Dallas May 20-21 http://bestpractical.com/training