Showing results for 
Show  only  | Search instead for 
Did you mean: 

Workflows: get data from a previous dql task to a new dql or javascript task

Hello everyone, maybe you can guide me. I have a problem. I don't know how I can call the data that two dql code tasks return to me, whether to use it in another dql or javascript task. I've tried using regular expressions, but I can't figure out how to integrate them into code. DQL from a previous task.
For example, the time_validation task returns the hour parameter that I need to use for aggregations in a new task with dql or javascript




Dynatrace Helper
Dynatrace Helper

You can access task result data in other tasks using expressions, specifically the result expression

In your example, you have a task "time_validation" with a result: records[{hour: 21, even....} .. ]
So in order to access the property hour in the first item of the records list, the expression would be

{{ result("execute_dql_query_1")["records"][0]["hour"] }}


Given that the DQL query records are always a list, you might want to loop over them and grab the hour, for example

{% for record in result("execute_dql_query_1")["records"] %}
	My Hour : {{ record.hour }}
{% endfor %}


Those expression can be used in any task input of any action with the exception of custom javascript, as this could lead to unwanted code injection. Therefore there is a javascript native option to access task results described here:

Note: in order to access task results, the source task needs to be a predecessor to the task where you reference its result. However it does not have to be the immediate predecessor. Assuming a linear workflow with 5 tasks, task 5 can still access any result from task 1-4.

Thank you for your answer, however it gives me an error when calling the result of the previous task as proof I am calling the total value of the previous task "request_validation" as seen in the image, the error log tells me that the variable does not exist






the expression looks good. Can you share the exact error message?
Also to make sure the tasks have a dependency with each other, can you share the conditions tab from the time_validation task?

Featured Posts