Grid Run Button - how it works? Example needed

Hi

I don’t clearly understand how run button works.

  1. I have a grid with column “e-mail”.
  2. I would like to send mail with run button to selected records
  3. But this mail should be send in one mail, so I need to collect all mails in onRecord and send it, not one by one but in one mail in onFinish

summary: I don’t want to execute code every record/line/row, but when I collect array of emails.

Could you please paste me example code how to deal with it?
Is possible to use in one Run Button “onRecord” to collect mails array, and send it in “onFinish”?

Thanks for any help.

daretki

In your grid’s onScriptInit event, put the following:

$_SESSION[‘email_list’] = array();

In the button’s onRecord, put this:

$_SESSION[‘email_list’][] = {email_address};

In the button’s onFinish, do the emailing, using the array of names as the “to”.

Dave