
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 12:32 PM
Hello!
My form has a list of departments and users are able to select multiples. In flow designer I want to grab the names of all departments they selected. Is this possible with just flow designer or do i need a script? If a script, can you suggest something? thanks so much.
Brian
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 04:55 PM
Thanks to everyone who provided feedback on this. Each of your answers helped me determine my best approach. I ended up doing the following:
1. Retrieve the list of departments they selected on form. This comes in the form of a comma separated string.
2. I created a custom action to turn that comma separated string in to an array.
3. I used a FOR EACH loop in the flow designer to cycle through the array. I wrote each department name in to a string called departments.
4. i added that departments string to the story record where I wanted it to land.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 02:06 PM
Can you explain in detail of your requirement? You want to access all the department names instead of sys_id's in flow designer?
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 02:54 PM
On our request form we ask them to select departments like this:
Then we want to take the departments they selected and paste them into the description field of a new story we created. Like this.
But this does not work - the "who is involved" is a list object so the story description shows nothing when its created.
How do I get the selected list items into the story description field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 10:17 PM - edited 09-12-2024 10:18 PM
You need one more script action step or use flow variable step before this step ..sample code
var selDep = current.variables.departments.toString().split(','); // Adjust field name as needed
var departmentNames = [];
for (var i = 0; i < selDep.length; i++) {
var deptRecord = new GlideRecord('cmn_department'); // Adjust table name
if (deptRecord.get(selDep[i])) {
departmentNames.push(deptRecord.name); // Assuming 'name' is the field for department name
}
}gs.info('Selected Departments: ' + departmentNames.join(', '));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 03:15 PM
This article seems relevant... looks like the list collector is providing a comma separated list to flow designer... bummer. This means I have to parse out that string into an array so i can lookup each or the sysIDs.... unless you can think of a better way.