How to retrigger the flow

Krutika Valanj2
Tera Contributor

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

2 REPLIES 2

Hemanth M1
Giga Sage
Giga Sage

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:

HemanthM1_0-1725549520667.png

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hajar BENJAHHAR
Mega Sage

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 : 

Screenshot_79.png

Best regards, 

Hajar