Resolve undefined variables error when evaluating loop expression in workflows

I am trying to create a workflow using a loop task which has a input from a DQL query. The loop task is referenced inside a HTTP request task . I keep getting the below error, looking for advice on what is that I am missing here please

Loop task

Error

Unhandled failed task(s) during workflow execution:

monitoringmode_update:
Error evaluating loop expression. Undefined variables: records.

Hey @p_devulapalli ,

I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you! :blush:
Please let me know what works best for you.

I am still having the same issue with my workflow.  I have a json response from a 3rd party api that has a listagent states. I am looping through the agentStates section of the json response and attempting to use a “Ingest Business Event” step to ingest each item in the list as its own event.

This is the input for the list: {{result(“get_nice_agents”)[“agentStates”]}}
- Dynatrace validates this is a list

The variable name I am setting for each iteration is agentState.  In my “Ingest Business Event” step I am using

{{ _.agentState }} | to_json

To reference the variable value of each iteration.

I get the following error:

Unhandled failed task(s) during workflow execution:

ingest_business_event_2:
Error evaluating loop expression. Undefined variables: agentStates.

The only place I am referencing “agentStates” is in the loop list definition.