Nice to know? Workflow task returns true or false

Hello,

When a workflow task returns Boolean true (or false),

{
“result”: true
}

to run the next task if to you need to use:

Who can confirm (-;

KR Henk

Hi Henk,

That would work, but we always recommend square brackets: {{result(“run_javascript_1”)[“result”] == false}}

Best, Haris

Edit:

It should be `True` or `False` (in capital letters), as these are valid names for Python booleans.

One could also use a “short form”, that is:

<span>{{ result("run_javascript_1")["result"] }}</span> 

Hi Haris,

Thanks for the comment!

KR Henk

It should be `True` or `False` (in capital letters), as these are valid names for Python booleans.

Sorry for nitpicking :see_no_evil_monkey:

One could also use a “short form”, that is:

<span>{{ result("run_javascript_1")["result"] }}</span>

Hello Michal,

In this case, the combination of TS and Python needs a little nitpicking (-;

So  above will work if the result of the task returns True or False,  but JS uses true and false. So you need to convert the return first? Or is this done automatic…

Thanks Henk

Hi Henk,

If a boolean value needs to be converted, we do that out of the box, so you don’t need to worry about that.

Hope this clarifies things a bit :slightly_smiling_face:

I see this thread is the most suitable thread for my question and I appreciate if some help in this frustrating workflow.

I have a workflow which I designed to wrap another Dynatrace API to give to another team. The workflow works fine but I am struggling to return only the final results json of the last task in the workflow and I use the following (see also the screen shot)

{{ result(“create_token”) }}

I add the above in the in the last box of the workflow option (see screenshot)

When I run the workflow from outside using the url of the workflow using the platform API from outside I never get the results of the last task in my workflow instead I only get the output of the workflow content like this,

Any idea what I need to do extra please?

Raw Response Content (bytes): b’{“id”:“e2b4522c-8993-4788-88eb-a40bbc697d8f”,“workflow”:“58803a59-3707-4cf0-a080-3d48c9c80194”,“state”:“RUNNING”,“stateInfo”:null,“input”:{“name”:“cloud_team_remove”,“days”:“30”},“providedInput”:{“name”:“cloud_team_remove”,“days”:“30”},“params”:{},“startedAt”:“2025-09-05T14:14:51.535710Z”,“endedAt”:null,“runtime”:0,“trigger”:“myname@x.com”,“schedule”:null,“eventTrigger”:null,“user”:“d5ab893c-edde-4351-b63c-7719f537bda9”,“actor”:“d5ab893c-edde-4351-b63c-7719f537bda9”,“title”:“WORKFLOW_NAME”,“result”:{},“triggerType”:“Manual”,“workflowVersion”:27,“workflowType”:“STANDARD”,“triggerTypeDetail”:{“userId”:“d5ab893c-edde-4351-b63c-7719f537bda9”},“parentExecution”:null,“parentTaskName”:null,“rootExecution”:null,“rootWorkflow”:“58803a59-3707-4cf0-a080-3d48c9c80194”,“isDraft”:false}’

I was expecting to get only the results of the output of my last task exactly in your case where you want true or false or True or False but my case I need the JSON results of the last task as I mentioned

I appreciate your support.

I have tried even to use the workflow API to fetch the results in another API call but it returns empty, I used this

Extracted Execution ID: <span>e2b4522c-8993-4788-88eb-a40bbc697d8f</span>

Fetching final result from: <a href="https://{environmentid}.apps.dynatrace.com/platform/automation/v1/workflows/executions/63937a06-8e39-47cd-b6d0-876e86d78dc5" target="_blank" rel="noopener nofollow noreferrer">https://TENANT_ID.dynatrace.com/platform/automation/v1/workflows/executions/<span>e2b4522c-8993-4788-88eb-a40bbc697d8f</span></a>

=== Final Workflow Execution Result ===
{}<br><br>Any more ideas is welcome

Good Morning Marwan,

I hope I understand the question correctly, otherwise I will remove this answer.

Simply put the workflow runs async.  The reply you get says: “state”:“RUNNING”,

So you have to wait until the WF is done.

So best is:          Loop(while running, wait)  if done → get the result.

KR Henk

Thanks Hank for your reply, there is not a way to wait, as it is a single invokation however, you may fetch the results like you said before in another thread, I am trying this API now

https://community.dynatrace.com/t5/Automations/How-to-retrieve-workflow-return-value-s-by-API/m-p/248615

You may also look at this thread: https://community.dynatrace.com/t5/Automations/How-to-retrieve-workflow-return-value-s-by-API/m-p/248615