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

2012-06-12 Thread Joe Harris
Is there a way in templates to build one with a conditional response
based on transaction type? (4.0.5)

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


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

2012-06-12 Thread Kevin Falcone
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

-kevin

 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


pgpgSoO40FGM9.pgp
Description: PGP signature