- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 05:43 AM
Hi,
I have in my form a list collector for the locations table. In my flow, I need to only get the name of each location and then join everything together in a string to pass it to a REST request.
Do you have any idea how to proceed?
Thank you,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2022 12:58 AM
The flow triggers on "Service Catalog". I am using the script on a "Set Flow Variables" step. I managed to do after searching for a long time. Here is my code:
var regionSysID = fd_data._1__get_catalog_variables.regions; // get the comma separated sys_ids
var list = regionSysID.split(","); //store it in an array
var regionArray = [];
for (var i=0; i < list.length; i++) {
var loc = new GlideRecord('cmn_location');
loc.get(list[i]);
regionArray.push(loc.getDisplayValue());
}
return regionArray.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2022 02:16 AM
much simpler line and no need to query
return fd_data.trigger.request_item.variables.regions.getDisplayValue();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2022 02:25 AM
I just tried and it does not return anything. Would getDisplayValue() work even though it's a list and not a unique reference?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2022 02:38 AM
Hi,
yes I have used it in the past and it worked fine
what it returns?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader