Flow Designer Records Lookup: Aggregate option?

tahnalos
Kilo Sage

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

3 REPLIES 3

Nick78
Tera Contributor

did you ever find a solution on this? I am trying to perform a similar sequence of actions with Flow designer.

TejaswiniY
Tera Contributor

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

 

 

Yaramala
Tera Contributor

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!