[rt-users] Make scrip run once per ticket, and only once

Kevin Falcone falcone at bestpractical.com
Thu May 22 16:27:15 EDT 2014

On Thu, May 22, 2014 at 09:52:04AM -0700, IT Guy wrote:
> I have a scrip that emails custom field values to a junk email address so
> that the values show up in transactions. This is necessary for various
> reasons I won't bother you with here.
> However, the current conditions I have allow the scrip to run several times
> per ticket. How can I stop this?
> This is the custom condition I wrote:
> my $Ticket = $self->TicketObj;
> return 0 unless $self->TransactionObj->Type eq 'CustomField';
> return 0 unless $Ticket->FirstCustomFieldValue('Keywords');
> return 1;
> Because there are several custom fields being emailed, with each one
> activating all the custom field scrips, this scrip is executed many times
> per ticket.

Either have your scrip set some other CF to track if the mail went
out, or only succeed if ALL your custom fields are set.  However, this
would still allow it to run more than once, so you really need some
other CF or an Attribute to track state.

You may want to explain why "the values show up in transactions" is
important since this sounds a bit like you're running into the XY

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 235 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140522/92942f60/attachment.sig>

More information about the rt-users mailing list