Trying to understand why my Loop block is not iterating correctly over the response from an External Data Action. I have a custom API endpoint that returns a simple JSON array of objects, and I need to process each item in Genesys Cloud Architect. The data action returns a 200 OK, and the response body looks correct in the test console, but the loop seems to skip or fail to map the properties.
Here is the JSON payload returned by the data action:
[
{"id": 101, "status": "active"},
{"id": 102, "status": "pending"}
]
I am mapping the body of the data action response directly to the loop’s collection field. Inside the loop, I am trying to access item.id and item.status. However, the flow logs show that the loop condition is never met, or the iteration count is 0.
Steps to reproduce:
- Create an External Data Action that calls a test endpoint returning the JSON array above.
- Set the data action’s response mapping to capture the raw
body. - Add a Loop block after the data action.
- Set the Loop’s collection to the data action’s response body field.
- Add a Set Data block inside the loop to log
item.id. - Run the flow. The loop does not execute.
I suspect the issue might be related to how Architect parses the JSON string versus an actual array object. Do I need to use a specific expression to convert the response string into an array before passing it to the loop? Or is there a specific way to reference the array elements in the loop configuration? I have tried using {{dataActionResponse.body}} and also wrapping it in a JSON parse function, but nothing seems to work. Any insights on the correct syntax for mapping a JSON array response to an Architect Loop would be appreciated.