[rt-users] Scrip custom condition question

Gene LeDuc gleduc at mail.sdsu.edu
Wed Jun 13 12:57:44 EDT 2007

Shannon, this is (literally) a textbook example of when to use 
TransactionBatch instead of TransactionCreate.  Within your scrip or 
template you can parse through all of the components of the transaction 
instead of firing on each one.

The Book has at least one example of using TransactionBatch and I think 
there are probably a couple of examples in the wiki as well.


At 07:40 AM 6/13/2007, Shannon Adams wrote:
>Using RT 3.6.3rc4.  What I want to do is send a comment to admin cc's, but 
>only if the comment is not part of a user closing/resolving a ticket.  I 
>have an "on resolve" script that includes all ticket history including all 
>comments.  How we typically resolve tickets is to use jumbo, then change 
>the status to "resolved", change the update type "reply to requesters", 
>then click save changes.  With the scripts I have setup now, the admin 
>cc's get two emails.  One for the comment, and one for the resolve.  The 
>problem is obviously my custom condition on the comment scrip.  It looks 
>like the ticket status if not yet "resolved" when the scrip fires, thus 
>the comment is sent even though the user has set the status to 
>resolved.  Any comments or suggestions on a way around this behavior?
>Here are the two global admin cc scrips.
>Description: On Comment Admin CCs
>Condition: On Comment
>Action: Notify AdminCcs as Comment
>Template: Global template: Admin Comment
>Stage: TransactionCreate
>Custom Condition:
>{ return $self->TransactionObj->Type eq 'comment' &&
>$self->TicketObj->Status ne 'new' &&
>$self->TicketObj->Status ne 'resolved'; }
>Description: Notify adminccs on resolve
>Condition: On Resolve
>Action: Notify AdminCcs as Comment
>Template: Global template: Resoolved Admin
>Stage: TransactionCreate
>Looking for a deal? Find great prices on flights and hotels with Yahoo! 
>Community help: http://wiki.bestpractical.com
>Commercial support: sales at bestpractical.com
>Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>Buy a copy at http://rtbook.bestpractical.com

Gene LeDuc, GSEC
Security Analyst
San Diego State University 

More information about the rt-users mailing list