[rt-users] Custom template/scrip with conditional responses

Kevin Falcone falcone at bestpractical.com
Tue Jun 12 21:48:52 EDT 2012

On Tue, Jun 12, 2012 at 10:43:18AM -0400, Joe Harris wrote:
> Is there a way in templates to build one with a conditional response
> based on transaction type? (4.0.5)

RT's Templates are just Text::Template, you can read more about the
syntax at http://search.cpan.org/dist/Text-Template/
You can absolutely say Subject: { if (blah blah blah) { } else {} }
There is more about the particular syntax of RT's templates available
in docs/customiziing/templates.pod


> Example:
> I have a template for owner change which works well.  On owner change
> notify of change adds the new owner in the subject like so:
> Subject: Owner change: {$Ticket->OwnerObj->Name}: {$Ticket->Subject}
> {$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
>  Transaction: {$Transaction->Description}
>        Queue: {$Ticket->QueueObj->Name}
>      Subject: {$Transaction->Subject || $Ticket->Subject ||
> {$Ticket->OwnerObj->Name} || "(No subject given)"}
>        Owner: {$Ticket->OwnerObj->Name}
>   Requestors: {$Ticket->RequestorAddresses}
>       Status: {$Ticket->Status}
>  Ticket URL: {RT->Config->Get('WebURL')}Ticket/Display.html?id={$Ticket->id}
>  Mobile URL: {RT->Config->Get('WebURL')}m/ticket/history?id={$Ticket->id}
> What I would like is to have one like that for Status change, but I
> don't want the users to get multiple emails on the same transaction.
> So if I could what an if statement around the subject line to
> determine what the change was and use one template for multiple
> purposes.
> If owner changes -> Show new owner in subject
> If status change -> Show new status in subject
> and/or even if both conditions, add both.
> Is this even possible?
> Thanks in advance for any insight!
> Joe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120612/d717c0e4/attachment.sig>

More information about the rt-users mailing list