Scrip with multiple custom fields checked

Hello list,

I have a scrip that checks to see if the value of several custom fields change. The intention is that if any one of the custom fields change it should execute the scrip action (in this case to send an email).

The problem I have is that the scip is executing once per identified change. i.e. if one of the custom fields change it calls the action once, but if three of the custom fields change it calls the action three times. I only want to call the action once regardless of how many custom fields change (i.e. if 1+ custom fields change, execute action once).

Any ideas on how to stop the action being called multiple times would be greatly appreciated.

This is my scrip:

Descripion: FooBar
Condition: User Defined
Action: Send Email
Template : FooBar Template
Stage: Transaction Create

Custom condition:
my $Transaction = $self->TransactionObj;
return 0 unless ( $Transaction->Type eq ‘CustomField’
&& ( $Transaction->Field eq ‘35’ ||
$Transaction->Field eq ‘36’ ||
$Transaction->Field eq ‘37’ ||
$Transaction->Field eq ‘38’ )
);
return 1;

There is nothing in the custom action fields.

Thanks for the help.

BenR

[snip]

I only
want to call the action once regardless of how many custom fields change
(i.e. if 1+ custom fields change, execute action once).

Template Stage: Transaction Create

I think you want the scrip to execute in TransactionBatch stage instead of
TransactionCreate. It does exactly what you want. You have to enable it in
your site config first.

– ============================
Tom Lahti
BIT Statement LLC

http://www.bitstatement.net/
– ============================

Thanks for this. I did a bunch of reading of the TransactionBatch stage in the wiki, but it wasn’t quite clear that this was what I wanted. You were right on the money.

Thanks,
BenR

[snip]

I only
want to call the action once regardless of how many custom fields change
(i.e. if 1+ custom fields change, execute action once).

Template Stage: Transaction Create

I think you want the scrip to execute in TransactionBatch stage instead of
TransactionCreate. It does exactly what you want. You have to enable it in
your site config first.

– ============================
Tom Lahti
BIT Statement LLC

http://www.bitstatement.net/
– ============================