Flow Designer Records Lookup: Aggregate option?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 09:02 AM
I have a repository form which uses two levels of grouping to gather data. Normally, I'd be using a Glide Aggregate to group the info into groups of the first level, then use a regular GlideRecord query to look through the data in the second level.
Can someone inform me how this can be done in Flow Designer? I note that there is a Look Up Records action in the Flow, but doesn't mention anything about grouping the findings if you have a two-level lookup.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 08:52 AM
did you ever find a solution on this? I am trying to perform a similar sequence of actions with Flow designer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 10:59 AM
Hello @tahnalos
Flow Designer in ServiceNow does not directly support multi-level grouping like GlideAggregate, but you can achieve a similar outcome using "Look Up Records" actions and loops. First, use a "Look Up Records" action to retrieve records based on the first-level grouping criteria, ensuring that a field acts as a grouping key. Then, use a For Each loop to iterate through the first-level grouped records and store unique values of the grouping field. Inside the loop, add another "Look Up Records" action to fetch the second-level records related to each first-level group by applying filtering conditions.
If Flow Designer's built-in actions are insufficient, a Script Action can be used instead. With a Script Action, you can use GlideAggregate for first-level grouping and GlideRecord to fetch second-level records, returning the structured data back to the Flow.
If this addresses your question, please mark this response as Accepted Solution and/or give it a Kudos if you find it helpful.
Thank you!
Tejaswini Y
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2025 04:00 AM
Hello @tahnalos
Flow Designer in ServiceNow does not directly support multi-level grouping like GlideAggregate, but you can achieve a similar outcome using "Look Up Records" actions and loops. First, use a "Look Up Records" action to retrieve records based on the first-level grouping criteria, ensuring that a field acts as a grouping key. Then, use a For Each loop to iterate through the first-level grouped records and store unique values of the grouping field. Inside the loop, add another "Look Up Records" action to fetch the second-level records related to each first-level group by applying filtering conditions.
If Flow Designer's built-in actions are insufficient, a Script Action can be used instead. With a Script Action, you can use Glide Aggregate for first-level grouping and Glide Record to fetch second-level records, returning the structured data back to the Flow.
If this addresses your question, please mark this response as Accepted Solution and/or give it a Kudos if you find it helpful.
Thank you!