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 problem. -kevin
pgp6trPPmvSgB.pgp
Description: PGP signature
-- RT Training - Boston, September 9-10 http://bestpractical.com/training
