- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 02:14 PM
Flow Designer Actions have an input variable option of type Records.
I am new to Flow Designer but am experienced with workflows and scripting. I would like to create an Action that given one or more User [sys_user] records iterates over those records and outputs a delimited string of user email addresses.
Input definition:
In the script step how do I loop through the User Records so that I can build the list and output it?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 03:21 PM
Hi,
The Records.[table] data type is affectively a usable glide record query so you can use the below to loop over it.
(function execute(inputs, outputs) {
var users = inputs.users;
var emails = [];
while(users.next()){
emails.push(users.getValue('email'));
}
outputs.email_addresses = emails.join();
})(inputs, outputs);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 02:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 02:45 PM
Sachin,
I'm aware of that. I first tried that in the flow that I want to call this action from, but Flow Designer doesn't provide variables that would allow me to build the list of email addresses I need.
When I first started developing my Action, I looked for a For Each step option. Actions don't offer Flow logic, except within a script. (I am working on Orlando).
My question is how do I work with the type Records input in a flow Action script. I'm assuming that my script will iterate over each record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 03:21 PM
Hi,
The Records.[table] data type is affectively a usable glide record query so you can use the below to loop over it.
(function execute(inputs, outputs) {
var users = inputs.users;
var emails = [];
while(users.next()){
emails.push(users.getValue('email'));
}
outputs.email_addresses = emails.join();
})(inputs, outputs);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 03:33 PM
Thanks
I actually figured that out while you were responding. My working script was identical to yours.
(function execute(inputs, outputs) {
var usersGr = inputs.Users;
var emails = [];
while(usersGr.next()) {
emails.push(usersGr.getValue('email'));
}
outputs.email_addresses = emails.join();
})(inputs, outputs);