[rt-users] Conditions in a template?
Gene LeDuc
gleduc at mail.sdsu.edu
Thu Sep 3 14:07:16 EDT 2009
Assuming that your auto-reply template is getting control via an
on-create scrip, the owner has already been set to B before your code
runs in the template (I think RT assigns everything before the on-create
transaction is recorded). In your template code you can check the
current value of Owner and, if it is Nobody or null, set it to A (and
don't do anything if it is something else). Something like
if ( $Ticket->Owner && $Ticket->Owner->Id == 10 ) { ### set owner to A }
To be more portable, you might want to compare to the actual Id() of the
"Nobody" user rather than hard-code in "10". On my 3.6.3 system,
"Nobody" is 10.
Regards,
Gene
testwreq wreq wrote:
>
>
> Dear RT Gurus,
>
> We have created cusomized "Auto Reply" templates for all the queues,
> that overwrites the "Global Auto Reply" template. I am wondering if
> anyone know of any documentation on customizing template with conditions?
>
>
>
> Basically, the first few lines of my customized template is assigning a
> owner 'A' to the queue, and it does not record the transaction.
>
>
>
> This is fine when the request is generated via email. However, we are
> coming accross a situation where users are generating request using the
> 'Ticket Create Option' of the interface and want to assign the ticket to
> another staff member.. i.e. oweber 'B'. The users are able to select
> owner "B" from the interface, but because of our customized template,
> the owner is written back as "A".
>
>
>
> Is there a condition that I can use to check the previous value of "owner"
>
> prior to assigning owner "B"?
>
>
>
> For Eaxmple, check if Field=>'owner' has a value,
>
> if yes, keep the same value and set RecordTransaction=>0, ELSE
>
> give the value as 'B' and set RecordTransaction=>0
>
>
>
>
>
> Any suggestions/hlp will be appreciated. Regards rq.
>
> ============= END ===========
>
>
>
> {
>
> ### assigns owner but doesn't record transaction ### Note that $owner
> needs to be the RT id for the owner object, ### not a name or e-mail
> address.
>
> my $owner = '22';
>
> $Ticket->_Set(Field=>'Owner', Value=>$owner, RecordTransaction=>0); $OUT
> .= ""; }
>
> Subject: AutoReply: {$Ticket->Subject}
>
>
>
> This message has been automatically generated in response to the
> creation of a trouble ticket regarding:
>
> {
>
> if ($Ticket->Subject() eq '') {
>
> $OUT .= " No Subject";
>
> }
>
> }
>
> { $Ticket->Subject() }
>
>
>
> A summary of which ...
>
> ===================
>
> {$Transaction->Content()}
More information about the rt-users
mailing list