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

Establish Criteria for Workflow Conditions

Fer_henrique
Observer

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

 

 

 

 

2 REPLIES 2

ChristopherHejl
Dynatrace Advisor
Dynatrace Advisor

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

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

ChristopherHejl_1-1738591870790.png

 

ChristopherHejl_0-1738591844512.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 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

StrangerThing
Helper

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

{{ result("put_execute").message != "No database registered" }}

Observability Engineer at FreedomPay

Featured Posts