[rt-users] Can Templates be Conditionalized Based on Recipient Address?

Duncan McEwan duncan at ecs.vuw.ac.nz
Tue Aug 4 20:36:41 EDT 2009


Hi,

We're running rt 3.8.4.

We have one particular queue for which we conditionalize the email sent out
based on the creator of the transaction generating the email.  We do this by
checking $Transaction->CreatorObj->Name in the template.

We'd also like to further customize the email based on who the email is going
to.  More precisely, we want the copy of the email going to the requestor to
say something slightly different to the copy going to the queue watchers.

I've experimented with several approaches, but haven't managed to get this
working.

I thought if I could get the ScripAction name I could include a test against
"Notify Owner", etc.  I tried getting that via
$Transaction->Scrips->First->ScripActionObj->Name, but the actions I got
back were not ones that were associated with this template.

I then tried getting the addresses associated with the current transaction
using $Transaction->Addresses, but that seemed to return empty lists
(though I could easily have been doing something wrong).

I could go into more detail regarding the above but in the interests of
keeping this email from getting any longer I won't.  I wasn't particularly
happy about either approach anyway, so before spending more time debugging
them, I thought I'd ask if anyone knew whether it was possible to
conditionalize templates in this way and if so, how.

While I've been writing this, it occurred to me that the easiest way to
achieve what I want might be to set up different templates for the different
scrips.  But because the templates are mostly identical I'd rather not have
that duplication if it is avoidable.

Thanks for any advice,

Duncan






More information about the rt-users mailing list