[rt-users] Detecting "new" ticket in a template

Schultz, Eric ESchultz at corp.untd.com
Thu Apr 27 11:57:14 EDT 2006


> I have a customer who wants to tailor his template verbiage 
> based upon 
> if the ticket is New, Updated, or Resolved ... I was originally just 
> going by the $Ticket->Status in the template, but they have a funny 
> habit of creating the ticket with the "open" status.  Obviously, this 
> throws off the template.
> 
> I have been trying to figure out if I can access the previous 
> value of 
> the $Ticket->Status, but so far have struck out.  I've played with 
> trying to get the list of transactions for the ticket, but if it's in 
> there, I can't get the right magic to work.

I believe you want this in your Custom Condition section:

# Process only if this is a new ticket.
return 1 if ($self->TransactionObj->Type eq 'Create');

And set Condition to "User Defined".  This will help you determine if
the ticket has just been created (whether it's a status of "new" or
"open" or whatever).  I believe you can also use this to check other
transactions, like 'Resolve'.



More information about the rt-users mailing list