Flow designer - foreach loop over Action return value (e.g., an Action that calls an external API)

Foster Hardie
Tera Expert

I'm getting a list of results from an external API REST call in an Action. The Flow ForEach construct specifies that it loops over Records. I've noticed that it will also iterate over List field types in a table object (though that may be because the List types reference actual Records). In an Action, the Outputs include types Record and List. Record, though, requires a Table for definition.

Here's the question: Is the only way to return an iterable set from an Action to create Records in a table, then return a reference to that?

 

5 REPLIES 5

Foster Hardie
Tera Expert

Is there anyone from ServiceNow watching this forum and able to answer this?

michaelslabodni
ServiceNow Employee
ServiceNow Employee

Hi Foster,

 

Yes, we are watching.

To give an answer on this one, right now with Flow Designer in Kingston the "For Each" logic is literally for a result of records that would've been queried from the table API. That basically means that if you want to use that logic in your flow then yes, you'll have to save the data from the REST call into another table, and then query that table for use in the Flow. It's far from ideal (like, in Egypt far...unless you live in Egypt, then it's Antarctica far, which is far for just about everyone, so we'll just go with 'Antarctica far' as a phrase). I did get feedback from product management that it's on the roadmap to improve the logic capabilities.

The only other option I can think to workaround this limitation would be if the "for each" steps are completed in a script as part of the REST action. Once again, that's still 'Antarctica far' ideal.

 

Michael

Foster Hardie
Tera Expert

Answer: 10 points

Feature deficit: 10 points minus the distance to Antarctica

 

Thanks for the clarification.

10-4.  When you play with Kingston, realize that it is just the beginning. We are going places ;).  This v1 feature is to iterate over a ServiceNow list.  We are absolutely planning on letting you do this with external data.  We just have a few other things in the backlog. Would love to learn more about how you want to use the solution.

-becky