Replies: 1 comment 1 reply
-
To create a workflow in Elsa Studio that sends multiple emails using the ForEach activity with a JSON payload like the one you provided, you can follow these steps:
Here's a simplified example of how the JSON might be used in a ForEach loop to send emails: {
"activities": [
{
"id": "foreach",
"type": "ForEach",
"properties": {
"collectionExpression": "{{ ApproversList }}"
}
},
{
"id": "send-email",
"type": "SendEmail",
"properties": {
"to": "{{ CurrentItem.email }}",
"subject": "Approval Needed",
"body": "Hello {{ CurrentItem.name }}, please review the document."
}
}
],
"connections": [
{
"sourceActivityId": "foreach",
"targetActivityId": "send-email",
"outcome": "Iterate"
}
],
"variables": {
"ApproversList": [
{
"id": 1,
"email": "[email protected]",
"name": "Bob Jones"
},
{
"id": 2,
"email": "[email protected]",
"name": "Joe Smith"
}
]
}
} Please note that the actual configuration might differ based on the version of Elsa you are using and the specific details of your workflow. If you encounter any issues, such as the ForEach activity's input dropdown being empty, you can try using a Liquid expression as a workaround, as mentioned in one of the sources. If you need further assistance or a more detailed example, please let me know. This comment was generated by Glime. |
Beta Was this translation helpful? Give feedback.
-
I am trying to create a workflow similar to the old document workflow in Elsa Studio. I'm facing issues with using the ForEach activity to send multiple emails from a JSON payload like the one below. Could anyone share an example that addresses this?
{
"Approvers": [
{
"id": 1,
"email": "[email protected]",
"name": "Bob Jones"
},
{
"id": 2,
"email": "[email protected]",
"name": "Joe Smith"
}
]
}
Beta Was this translation helpful? Give feedback.
All reactions