# Establish Criteria for Workflow Conditions

**URL:** <https://community.dynatrace.com/t/establish-criteria-for-workflow-conditions/50055>\
**Category:** Automations\
**Tags:** workflows, automation\
**Created:** [February 3, 2025, 1:37pm UTC](https://community.dynatrace.com/t/establish-criteria-for-workflow-conditions/50055 "2025-02-03T13:37:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fer\_henrique](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@Fer\_henrique](https://community.dynatrace.com/u/Fer_henrique)\
**Post date:** [February 3, 2025, 1:37pm UTC](https://community.dynatrace.com/t/establish-criteria-for-workflow-conditions/50055/1 "2025-02-03T13:37:38Z")

</div>

I am creating an automation for the registration of new databases via Dynatrace Workflows and I send a notification via Teams when a database is registered. However, we do not always have a database to register, and when there is none, I return a message saying “No Database.” I am looking for a condition so that when this message is received in the Workflows, it does not trigger the notification, and only sends the notification when a database is actually registered. I would appreciate the community’s support in trying to create this, as I have made several attempts without success.

 ![Fer_henrique_1-1738589830686.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/3/63071579b099cda1e2381682e306c756d3e1f692.png)

---

<div class="post-metadata">

**Author:** ![ChristopherHejl](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/christopherhejl/32/20735_2.png) [@ChristopherHejl](https://community.dynatrace.com/u/ChristopherHejl)\
**Post date:** [February 3, 2025, 2:14pm UTC](https://community.dynatrace.com/t/establish-criteria-for-workflow-conditions/50055/2 "2025-02-03T14:14:58Z")

</div>

Hi,

assuming you have a workflow with multiple tasks, one of which the “put\_execute” you screenshoted, that has the message you want to depend upon.  
Assuming you have a followup task to this, that sends the MS teams message, you can add a custom condition on the conditions tab of the task which sends the ms teams message, to only run if the message is NOT “no database registered.” the conditions would be

```python
{{ result("put_execute")["message"] != "no database registered." }}

```

 ![ChristopherHejl_1-1738591870790.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/f/0f545346f0fb55615c764861615e25d7616f73ce.png)

 ![ChristopherHejl_0-1738591844512.png](https://global.discourse-cdn.com/dynatrace/original/2X/9/974d6e4ccf2d524d47b75cb08a0db38d364e0100.png)

The custom condition can contain any expression that results in a boolean. In this case we check the message of the result of the previous task and compare to a string. You can also use other functions, use things like regex search, compare integer values etc. See&nbsp;[Jinja expressions for Workflows — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/automation-workflow-expression-reference#strings)  
I’d suggest to rely on a bit of a different value than the message as it’s easy to change the message slightly, like capitalizing, removing a “.”, etc and break your condition.

Best,  
Christopher

---

<div class="post-metadata">

**Author:** ![StrangerThing](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/strangerthing/32/12182_2.png) [@StrangerThing](https://community.dynatrace.com/u/StrangerThing)\
**Post date:** [February 3, 2025, 2:15pm UTC](https://community.dynatrace.com/t/establish-criteria-for-workflow-conditions/50055/3 "2025-02-03T14:15:05Z")

</div>

I think it would be something like this in your condition setting for the notification step.

{{ result(“put\_execute”).message != “No database registered” }}
