# WorkFlow - stop if no data was retrivied from the API

**URL:** <https://community.dynatrace.com/t/workflow-stop-if-no-data-was-retrivied-from-the-api/49104>\
**Category:** Automations\
**Tags:** workflows\
**Created:** [November 28, 2024, 8:24am UTC](https://community.dynatrace.com/t/workflow-stop-if-no-data-was-retrivied-from-the-api/49104 "2024-11-28T08:24:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yann\_Buccellato](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@Yann\_Buccellato](https://community.dynatrace.com/u/Yann_Buccellato)\
**Post date:** [November 28, 2024, 8:24am UTC](https://community.dynatrace.com/t/workflow-stop-if-no-data-was-retrivied-from-the-api/49104/1 "2024-11-28T08:24:00Z")

</div>

Good morning community,

I’m using workflow to retrieve data from D365 and then push it to Dynatrace.  
Sometimes the call to the api doesn’t provide any data and push\_log\_to\_dynatrace step will fail. (see image)

 ![y_buccellato_0-1732782164819.png](https://global.discourse-cdn.com/dynatrace/original/3X/5/1/51fbc8d492c96264fe2451bb4e280c33bcc2be25.png)

I was wondering: how can I put a condition that stop the flow if no data was retrieved from the API?

Regards

---

<div class="post-metadata">

**Author:** ![Peter\_Youssef](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/peter_youssef/32/14668_2.png) [@Peter\_Youssef](https://community.dynatrace.com/u/Peter_Youssef)\
**Post date:** [December 4, 2024, 7:57am UTC](https://community.dynatrace.com/t/workflow-stop-if-no-data-was-retrivied-from-the-api/49104/2 "2024-12-04T07:57:47Z")

</div>

Hello&nbsp;[@y\_buccellato](https://community.dynatrace.com/user/4804)

PFA resource for further details:

- [Build workflows — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/workflows-building#task-options)

Hoping it helps.

BR,

Peter

---

<div class="post-metadata">

**Author:** ![Yann\_Buccellato](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@Yann\_Buccellato](https://community.dynatrace.com/u/Yann_Buccellato)\
**Post date:** [December 4, 2024, 9:12am UTC](https://community.dynatrace.com/t/workflow-stop-if-no-data-was-retrivied-from-the-api/49104/3 "2024-12-04T09:12:03Z")

</div>

Unfortunately no, but I appreciate your help.

Condition should be “if you have no value in the array then gracefully stop the execution” and I don’t find a practical reference to do that.

I revert back to using Power Automate which has an extensive documentation and use case already covred.

Thank you

---

<div class="post-metadata">

**Author:** ![christian\_kreuz](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/christian_kreuz/32/21669_2.png) [@christian\_kreuz](https://community.dynatrace.com/u/christian_kreuz)\
**Post date:** [December 6, 2024, 11:02am UTC](https://community.dynatrace.com/t/workflow-stop-if-no-data-was-retrivied-from-the-api/49104/4 "2024-12-06T11:02:10Z")

</div>

You can use [Task Conditions](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/building#task-conditions) to enable/disable a Task based on a previous task. In this particular case, you can use the [length filter](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/reference#filters).

For example, on the task **post\_log\_into\_dynatrace** , switch to Conditions, and try out the following expression in the “And custom condition was met” field:

```markup
{{ result("d365_masterdata_intmat").json.value | length > 0 }}

```

 ![christian_kreuz_0-1733482885708.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/24df05e231d662c6ad43962a2bde3abc257a49d0.png)

This should lead to this specific task not being executed when the result is an empty list.

 ![christian_kreuz_1-1733482920111.png](https://global.discourse-cdn.com/dynatrace/original/3X/8/6/862d4ddf6b0d69f13cb61f92869759549c89722c.png)

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Peter\_Youssef](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/peter_youssef/32/14668_2.png) [@Peter\_Youssef](https://community.dynatrace.com/u/Peter_Youssef)\
**Post date:** [December 6, 2024, 11:05am UTC](https://community.dynatrace.com/t/workflow-stop-if-no-data-was-retrivied-from-the-api/49104/5 "2024-12-06T11:05:07Z")

</div>

Hi&nbsp;[@christian\_kreuz](https://community.dynatrace.com/user/23530)

Appreciated attempt.

BR,

Peter
