Javascript variable in email address in workflow

Hi,
in the workflow automation help it is stated that:
Advanced TIP. In the static email it is possible to use a JavaScript variable calculated before. It should contains an array of strings (emails), one string or string with emails separated by semicolon. The variable must be in doo.workflow.runningData object. e, g, doo.workflow.runningData.customers. Just set that in the previous step and put it into static email field.

I have trouble understanding how this works. I have a table with a calculated TEXT field that contains email addresses in format “address1@rmail.com;address2@email.com…” etc.
The workflow is running for this table.

Now how precisely to get that to a variable ? I tried several approaches, but I either get an error, or it does not do anything.

Hello Denis,

the way, how you can achieve it is to get the value from the email field (it should work for a text field with multiple addresses) and save it to the doo.workflow.runningData._nameYouWant property and you use it in the address field in the email action.

In the JS box you use following script (supposing your field containing the addresses is called emailsText):
doo.workflow.runningData._multipleEmails = doo.model.emailsText.value;

and in the email module you use this property in the To: field.

Hope it works for you.
Anna

Fantastic, thank you very much Anna :slight_smile:
Somehow I was confused by the “variable” wording.
This works just as I intended !