In Workflows, sometime we may need to get emails for dynamic destination users (one or more destination users separated by semi-colon ’;’).
To achieve this, we need to do as follows:
- Add two Process Data Fields, one for storing User IDs and another for getting User emails.
- MultiUserIDs – Process field to store semi-colon(;) separated list of User IDs
Ex: k2:denallix\administrator;k2:denallix\bob.
Note: you can also pass data without K2 label,
Ex: denallix\administrator;denallix\bob
- MultiUserEmails – Process field to fetch and store semi-colon(;) separated list of User Email Ids for the input User IDs.
- Add a default Activity. Configure the destination rules as follows:
- Run the Destination Wizard in “Advanced Mode”
- Select “All at Once”
- Select “Create a slot for each destination” and “Resolve all roles and groups to users”
- In the Destination Sets, Add New Destination with Split function as follows:
- Click on “Finish” button
- Add the event, “Default Server Event(Code)” to the above activity.
- Go to the code event by,
- Add the following Code for the code event. This code will loop through the destination users and get emails for the multiple destination users and concatenate them with semi-colon(;).
- That’s it. After that, you can add an email event with “MultiDestEmails” as “To field’ to send emails to all destination Users.
- Once you run this, you will get the Output as follows:
No comments:
Post a Comment