[rt-users] RT send 2 mail notification for setting the ticket owner

Bill Cole rtusers-20090205 at billmail.scconsult.com
Tue May 12 13:06:36 EDT 2015


On 11 May 2015, at 17:50, Rabin Yasharzadehe wrote:

> On Sun, May 10, 2015 at 7:45 PM, Bill Cole <
> rtusers-20090205 at billmail.scconsult.com> wrote:
>
>> On 10 May 2015, at 5:41, Rabin Yasharzadehe wrote:
>>
>> First mail looks like this,
>>>
>>> Sun May 10 12:27:14 2015: Request 242534 was acted upon.
>>>
>>>> Transaction: Given to rabin by X
>>>> Queue: sandbox
>>>> Subject: *(No subject given)*
>>>> Owner: rabin
>>>> Requestors: rabin
>>>> Status: new
>>>> Ticket: https://rt
>>>>
>>>>
>>> ​the 2nd mail notification look like this,
>>>
>>> ​​​​Sun May 10 12:27:14 2015: Request 242534 was acted upon.
>>>
>>>> Transaction: Owner set to rabin by X
>>>> Queue: sandbox
>>>> Subject: *(No subject given)*
>>>> Owner: rabin
>>>> Requestors: rabin
>>>> Status: new
>>>> Ticket: https://rt
>>>>
>>>
>>>
>>> ​why is that ? ​
>>>
>>
>> You have 2 different scrips being triggered by the same transaction. 
>> You
>> can find which scrip is sending which message by looking at the 
>> Message-Id
>> header. An example from my system:
>>
>> Message-ID: <rt-4.2.9-96149-1430920514-473.15045-118-0@[rt hostname]>
>>
>> That's: rt-version-Trans-EpochSec-msecs-Ticket-Scrip-MailSeq at hostname
>
>
> ​Thank you Bill,
> your tip was very helpful (and probably also in the future)​
>
> I found the scrip which send the email notification,

Based on what you posted, I would expect there to be 2 different scrips, 
one for each message. Your solution will probably involve selecting one 
of them to keep and disabling the other.

> but it is not familiar
> to me,
> the condition is "User defined" but i can't understand the Perl code,
>
> can you help please ?
>
> ----
> my $txn = $self->TransactionObj;
> return 0 unless $txn->Field eq "Owner";
> return 0 if $txn->NewValue == $txn->Creator;
> return 1;
> ----

That means the scrip action (sending an email notification using the 
selected template) will trigger only on transactions that (1) change the 
ticket's "Owner" field and (2) set the new value of "Owner" to a value 
that is not equal to the "Creator" field of the transaction. In other 
words: the scrip triggers when a user gives a ticket to someone else.






More information about the rt-users mailing list