03 Feb 2025 01:37 PM
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.
Solved! Go to Solution.
03 Feb 2025 02:14 PM
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." }}
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
03 Feb 2025 02:15 PM
I think it would be something like this in your condition setting for the notification step.
{{ result("put_execute").message != "No database registered" }}