# Condition for matching in the workflow

**URL:** <https://community.dynatrace.com/t/condition-for-matching-in-the-workflow/43958>\
**Category:** Automations\
**Tags:** workflows\
**Created:** [February 2, 2024, 7:05pm UTC](https://community.dynatrace.com/t/condition-for-matching-in-the-workflow/43958 "2024-02-02T19:05:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HelderCosta](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@HelderCosta](https://community.dynatrace.com/u/HelderCosta)\
**Post date:** [February 2, 2024, 7:05pm UTC](https://community.dynatrace.com/t/condition-for-matching-in-the-workflow/43958/1 "2024-02-02T19:05:18Z")

</div>

Hello everybody

I’m setting up a simple workflow with the following flow:

job\_test: executes the query below:

fetch logs, from: -1d  
| filter contains(content, “Job\_OK\_Test”)  
| summarize count()

And the result if positive is:

 ![heldercosta82_0-1706900071451.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/a/7a2b8cec00b370eae64a6eff6d3df49415367553.png)

In the next step, send\_messafe\_ok  
I configured the following condition: “{{ result(“job\_test”).records | length \> 0 }}”

 ![heldercosta82_1-1706900296783.png](https://global.discourse-cdn.com/dynatrace/original/2X/0/05687c5c0ded9ca45aa08145f6bb1ce82d2deae7.png)

But I believe I’m skipping a step, because it’s not matching and the flow stops with the following error:

Error evaluating custom condition - Attempting to use result of unfinished task. Please make job\_test a predecessor of send\_message\_ok.

 ![wf-dyna.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/2/322dec7d41606cd7b1ebca87871dde5dd764d287.png)

If anyone can share something I would be grateful.

Tks

---

<div class="post-metadata">

**Author:** ![HelderCosta](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@HelderCosta](https://community.dynatrace.com/u/HelderCosta)\
**Post date:** [February 15, 2024, 2:20pm UTC](https://community.dynatrace.com/t/condition-for-matching-in-the-workflow/43958/2 "2024-02-15T14:20:37Z")

</div>

For it to work we need to adjust the DQL as follows:

Example:

fetch logs, from: -10h  
| filter contains(content, “Finalizado DesativarAnunciosPJSemAtualizacaoJob”)  
| summarize execute = count()  
| FieldsAdd response = if(execute \> 0, “true”,else:“false”)

 ![HelderCosta_0-1708006523307.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/d/edef8f53e38cb58088811d713115e3660352d9d8.png)

And the result will show true or false, and this value we will set the condition for sending the message:

 ![HelderCosta_1-1708006744477.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/237f838e2afa0a29cd72f153e5e9e58e1e4a96cc.png)

Condition Send Message OK:  
{{ result(“job\_desativa\_anuncio\_pj”).records[0].response == ‘true’ }}

Condition Send Message Fail:

{{ result(“job\_desativa\_anuncio\_pj”).records[0].response == ‘false’ }}
