How to retrigger the flow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 07:50 AM
Hello,
I am trying to retrigger the flow when the date is changed in the catalog variables in RITM.
The script mentioned is cancelling the flow triggered while submitting the catalog form , but not retriggering it.
(function executeRule(current, previous /*null when async*/ ) {
var now_GR = new GlideRecord("sys_flow_context");
now_GR.addQuery("name", "xxxxxx");// flow designer name
now_GR.addQuery("source_record="+current.sys_id);
now_GR.query();
while (now_GR.next()) {
sn_fd.FlowAPI.cancel(now_GR.getUniqueValue(), 'Canceling xxxxxxx'); // flow designer name
}
startFlowDesignerFlow(current);
function startFlowDesignerFlow(current) {
var flow = current.cat_item.flow_designer_flow;
var flowName = flow.sys_scope.scope + "." + flow.internal_name;
sn_flow_trigger.FlowTriggerAPI.fireCatalogTrigger(flowName, current);
}
})(current, previous);
Please let me know if any way we can retrigger the flow
Thanks
Krutika

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 08:19 AM
Hi @Krutika Valanj2 ,
Why don't you try creating code snippet from the flow attached to the catalog item and use that to retrigger
Navigation:
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 10:20 AM
Hello @Krutika Valanj2 ,
How did you designed your flow, what trigger did you use , what conditions did you apply to the trigger ?
If you used the table [sc_item_variables_task] and you want to trigger the flow when the date is modified, you can just change the run trigger from Once to For every update as shown in the below screenshot :
Best regards,
Hajar