Flow Designer - Trigger conditions gone wrong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 08:20 AM
Hello all,
I have developed a flow logic. When an incident is assigned to "Incident management Team" and there is no action is taken for 24 hours, a notification is triggered to the teams supervisor and the flow will wait for another 24 hours for the state to be changed, if there is no action taken for another 24 hours (24+24). One more notification will be sent to teams supervisor and supervisors manager (In cc). It is all working fine until they have raised a with a bug. When the assignment group is changed multiple times, flow is supposed to stop and restart when the incident comes to "Incident management's que again. But this is not the case. Once the flow is triggered, irrespective of the assignment group, notifications are being triggered to the supervisor and the supervisors manager. Please help me how would I stop the flow when the Incident's assignment group is changed to a new assignment group other than IMT and restart when the group changes to IMT again.
Thanks in advance !
__PRESENT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 08:42 AM
Can you try changing the run - trigger you have put in the trigger section ?
Refer the screenshot attached if it answers your question.
To understand appropriate Run - Trigger for your use case, check this link. Once you change the "Run - Trigger", you should be able to get this working.
https://docs.servicenow.com/bundle/tokyo-application-development/page/administer/flow-designer/refer....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 09:18 AM
Instead using that as a trigger I think you need to run schedule as trigger cause you are checking the time continuously and sending notifications only when the time reaches 24 hours from creation.
And for the group change issue, I'd suggest do two lookup on the sys_history_line table and check the latest assignment group activity and then calculate the time from the latest updated time to the current.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 09:32 AM
@Jagan Pillutla You should create an onBefore Update business rule on your table which should have condition when the Assignment group changes from IMT.
Use the following script in the script field to cancel the existing flow context.
var now_GR = new GlideRecord("sys_flow_context");
now_GR.addQuery("name", "NAME OF FLOW TO CANCEL HERE");
now_GR.addQuery("source_record",current.getValue('sys_id'));
now_GR.query();
if (now_GR.next()) {
sn_fd.FlowAPI.cancel(now_GR.getUniqueValue(), 'Canceling Test Flows');
}
The above business rule will cancel the flow context whenever the assignment group changes from the IMT group to some other assignment group.
In your flow's trigger condition also add a condition to check if the assignment group is IMT.
With these changes, your flow will trigger whenever the assignment group is IMP and would get cancelled whenever the assignment group changes from IMT to some other group.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 10:01 AM
Hi, what action does your flow use to wait for 24 hours?
You can use "Do the following in Parallel" flow logic together with the "End flow" for terminating the flow.
Hope it helps.