[rt-users] TransactionBatch scrip got fired twice

Daniel Silveira DSilveira at prmg.mpf.gov.br
Fri Sep 30 13:09:20 EDT 2011


I tried both action boxes, the same problem happened.
My RT is 4.0.2 fresh install, imported database from RT 3.8.8. 
To add more info, I changed the log a bit. The configuration now is:
 
Condition: on transaction
Action: User Defined
Template: Global template: Blank
Stage: TransactionBatch
 
Custom condition: 
       empty
Custom action preparation code: 
      $RT::Logger->info("Id: ".$self->TransactionObj->Id);
      $RT::Logger->info("Field: ".$self->TransactionObj->Field);
      $RT::Logger->info("Type: ".$self->TransactionObj->Type);
      $RT::Logger->info("NewValue: ".$self->TransactionObj->NewValue );
      return 1;
Custom action cleanup code:
      return 1;
 
The log after changing the Time Worked to 30min:
 
[Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)
[Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)
[Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)
[Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)
[Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)
[Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)
[Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)
[Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)
I noticed that the problem doesn't happen when the scrip is acting upon "on comment" condition.
But with other conditions like "On Status Change" and "On Owner Change" the problem persists.
If I change the action to "Send Email", which is what i want, the system sends 2 emails.
 
Thanks in advance.
Daniel Silveira

>>> Kevin Falcone <falcone at bestpractical.com> 09/29/11 6:56 pm >>>
On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
>    Hi,
> 
>    I have the exact same problem with a very simple test-only scrip:
> 
>    Condition:  on a transaction
>    Action: user defined
>    Stage: TransactionBatch
> 
>    Action code:
>    $RT::Logger->info($self->TransactionObj->Id);

There are two action boxes.

Custom action preparation code:
Custom action cleanup code:

Which one did you put the log in.
What did you put in the other one.

-kevin

>    Every transaction generated fires twice this scrip. If I chage the stage to TransactionCreate,
>    then it works.
> 
>    Logfile:
>    [Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
>    [Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
>    [Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
>    [Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
>    Thank you.
>    Daniel Silveira
> 
>  On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
>  > Hi,
>  >
>  > I have a scrip to to check when the ticket status changes. If I put it as TransactionBatch mode,
>  > each time I change the ticket status, the scrip got fired twice and there will be dupllicated emails
>  > sent out. I had to use TransactionBatch, since we want an email notification to be sent out when
>  > either
>  > 1.  the user use reply and modify the ticket status
>  > 2. modify the ticket status
>  >
>  > TransactionBatch works fine when user reply and modify ticket status but got duplicated emails when
>  > just change ticket status.
> 
>  Please show your scrip configuration
> 
>  -kevin

> --------
> RT Training Sessions (http://bestpractical.com/services/training.html)
> *  San Francisco, CA, USA ? October 18 & 19, 2011
> *  Washington DC, USA ? October 31 & November 1, 2011
> *  Melbourne VIC, Australia ? November 28 & 29, 2011
> *  Barcelona, Spain ? November 28 & 29, 2011

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110930/16cd969d/attachment.htm>


More information about the rt-users mailing list