Does anyone know what parameters I need to define in the DAVIS EVENT TRIGGER in the workflow that is trigger the workflow when a DAVIS AI closes a problem.
I appreciate any support on this.
Does anyone know what parameters I need to define in the DAVIS EVENT TRIGGER in the workflow that is trigger the workflow when a DAVIS AI closes a problem.
I appreciate any support on this.
Hi @MarwanC
Maybe I do not understand your request well.
In case on Davis Problem trigger there are two options active and active or closed:
In case of Davis event trigger you can use this DQL:
fetch events
| filter matchesValue(event.status, âCLOSEDâ)
I hope it helps.
Best regards,
JĂĄnos
Thanks indeed. In order to summarise this to other as well, there different places where you can focus the type of the trigger event when it comes to your workflow
1) In the trigger box, there is a pulldown menu which you choose, active or active or closed, this will give you the otion, it will be nice to have a feature to have the closed aswell.
2) You can also implement a gate box to allow what you need ACTIVE or CLOSE like this:
import { execution } from â@dynatrace-sdk/automation-utilsâ;
import { settingsObjectsClient } from â@dynatrace-sdk/client-classic-environment-v2â;
import { result } from â@dynatrace-sdk/automation-utilsâ;
export default async function ({ execution_id }) {
const exe = await execution(execution_id);
const eventContext = exe.event(); // Access the event payload
const problemId = eventContext[âevent.idâ]; // Extract the problem ID
const displayId = eventContext[âdisplay_idâ]; // Extract the problem Display ID
const eventStatus = eventContext[âevent.statusâ];
console.log(âProblem ID (Used in the API):â, problemId);
console.log(âProblem Display ID (Used in the Problems APP):â, displayId);
console.log(âProblem Event Status:â, eventStatus);
console.log(âPayload:â, eventContext);
//
Check if eventStatus is not CLOSED
if (eventStatus == âACTIVEâ) {
console.log(âeventStatus=â, eventStatus);
return 0;
}
return {
problemId,
displayId,
eventStatus
};
}
and in the next task you stop the workflow by a matcher in the condition section of the task: {{ result(âgateâ) != 0 }}
So overall you can control the workflow by filter at the top or using gates.
One important thing as well to mention is very important to add a wait task at the begining of the workflow as the trigger can go go out of control when problems flooding can occur.
Hope this helps you in your workflow design.
Hi @MarwanC ,
I think you need the condition you need is
event.status_transition == âCLOSEDâ
This field dectects when an event on status âActiveâ goes to âClosedâ
Test it and I hope it works.
Regards,
Elena.
If there are cases where users close problems manually and you want to exclude those from your workflowâso that it only processes problems closed by Davisâyou could add the dt.davis.mute.status field to your filter.
event.status_transition == âCLOSEDâ AND dt.davis.mute.status == âNOT_MUTEDâ