[rt-users] Ticket/ModifyPeople.html triggers Scrips

Ruslan Zakirov ruz at bestpractical.com
Tue Feb 28 09:23:06 EST 2012


On Tue, Feb 28, 2012 at 18:18, Mark D. Nagel <mnagel at willingminds.com> wrote:
> Yes, of course. The Scrip has always worked. The question is, why is it
> executing in this context when no actual changes to the ticket have been
> performed?

Scrips are executed update in DryRun mode, but are not committed. This
is done to get recipients and display them in UI. This is why scrips
shouldn't perform any update actions in Prepare code.

> Thanks,
> Mark
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> Ruslan Zakirov <ruz at bestpractical.com> wrote:
>>
>> I hope you picked User Defined condition in the dropdown.
>>
>> On Tue, Feb 28, 2012 at 05:03, Mark D. Nagel <mnagel at willingminds.com>
>> wrote:
>> > I have been troubleshooting an interesting problem since we upgraded to
>> > RT
>> > 4.0.5.  If we have a new unassigned ticket and simply open the page
>> > Ticket/ModifyPeople.html, one of our Scrips fires off email without any
>> > other action (and the owner is not actually changed).  The scrip has a
>> > custom condition to check if this is an assignment transaction (see
>> > below).
>> >  The action is 'Notify Owner' and template is 'Ticket Assigned'.  Point
>> > is,
>> > since this is not an actual transaction, but just bringing up a form, it
>> > doesn't seem like it should trigger this Scrip.  I looked at the source
>> > and
>> > I see that there is a DryRun call in the INIT section, but it seems
>> > like!
>>   it
>>
>> > should not be causing any email to be sent.  Am I dealing with a bug, or
>> > do
>> > I have a bum Scrip?
>> >
>> > Thanks,
>> > Mark
>> >
>> > my $Transaction = $self->TransactionObj;
>> > my $Ticket = $self->TicketObj;
>> >
>> > # similar to OnOwnerChange, but only trigger if actor is not the new
>> > owner
>> > and
>> > # new owner is not 'nobody'
>> > return 0 unless $Transaction->Field eq 'Owner';
>> > return 0 if $Transaction->OldValue == $Transaction->NewValue;
>> > return 0 if $Transaction->Creator == $Transaction->NewValue;
>> > return 0 if $Transaction->NewValue == $RT::Nobody->Id;
>> >
>> > my $field = $Transaction->Field;
>> > my $old = $Transaction->OldValue;
>> > my $new = $Transaction->NewValue;
>> > my $creator = $Transaction->Creator;
>> > my $type = $Transaction->Type;
>> > $RT::Logger->debug("On Assign Not!
>>  ify
>> Owner Condition - type: '$type' field:
>>
>> > '$field'  old: '$old' new: '$new' creator: '$creator'");
>> >
>> > return 1;
>> >
>> >
>> > --
>> > Mark D. Nagel, CCIE #3177<mnagel at willingminds.com>
>> > Principal Consultant, Willing Minds LLC (http://www.willingminds.com)
>> > cell: 949-279-5817, desk: 714-495-4001, fax: 714-646-8277
>> >
>> > ** For faster support response time, please
>> > ** email support at willingminds.com or call 714-495-4000
>> >
>> > --------
>> > RT Training Sessions (http://bestpractical.com/services/training.html)
>> > * Boston  March 5 & 6, 2012
>>
>>
>>
>> --
>> Best regards, Ruslan.
>>
>> This message has been scanned by CanIt-PRO.
>
>
> --------
> RT Training Sessions (http://bestpractical.com/services/training.html)
> * Boston — March 5 & 6, 2012



-- 
Best regards, Ruslan.



More information about the rt-users mailing list