- 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 03:39 PM
spooky!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 06:47 AM
It is actually dangerous to use this type of input variable. The thing is that after the step ran, the input variable is no longer in the same state (before, the Cursor is before the first record, afterwards it is after the last record).
This kind of side-effect leads to errors that are very hard to debug.
Therefore, I think it is better (but less efficient) to pass sys_ids or lists of sys_ids and perform an explicit query in the function.
Best
Daniel
If this answer was helpful, I would appreciate if you marked it as such - thanks!
Best
Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2022 10:18 AM