List Collector values Dot Walking
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 04:51 AM - edited 05-15-2025 04:52 AM
Hi All,
I am working on obtaining the values from a list collector and once I split and obtain the individual values by looping through the individual values. I have two queries:
1)What is the most efficient way to loop through all values.
2)Once we have the individual sys_ids , can we dot walk them and obtain other values or is dot walking not possible when sys_ids are retrieved from list collector.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 04:57 AM
it depends on where are you doing this operation?
1) if in flow then you can use FOR Each to iterate over
See this on how you can iterate easily using Flow
OR
2) if you are doing in workflow then only option is to use Run Script
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-15-2025 05:12 AM
Yes I am doing it in a Script Include , in that case is splitting and then iterating through the values is the most efficient way ? Also could you please let me know on the second point ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 05:22 AM
the 2nd point talks about scripting only.
The 1st point is valid and has approach when you are using flow
In scripting you are on right track
1) get the value, split it with comma
2) you get the array
3) then you can iterate and perform GlideRecord query to get whatever field value you want
Another way without split is this -> use IN in the addQuery with sysId
var listCollectorValues = current.variables.listCollectorVariableName.toString();
var gr = new GlideRecord("tableName");
gr.addQuery("sys_id", "IN", listCollectorValues);
gr.query();
while (gr.next()) {
gs.info(gr.fieldName);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-15-2025 06:33 AM
@Ankur Bawiskar There is one more point in the second query , can we dot walk using the sys_ids received from list collector ? like if we have a reference field for a sys_user table and we dot walk to the fields on sys_user table , similarly if we have a list collector of multiple users can we also dot walk or no ?