Rerun Flow

athavichith
Mega Sage

How do I rerun a flow that failed or did not generate a task after I had made a modification to the flow?

1 ACCEPTED SOLUTION

@athavichith 

you can use this to re-run the flow for your RITM

FlowAPI - Scoped, Global 

FlowAPI - Scoped, Global 

var grScReqItem = new GlideRecord('sc_req_item');
grScReqItem.addEncodedQuery("number=RITM0001"); // provide a Query
grScReqItem.query();
if (grScReqItem.next()) {
    try {
        var inputs = {};
        inputs['request_item'] = grScReqItem; // GlideRecord of table: sc_req_item
        inputs['table_name'] = 'sc_req_item';
        var contextId = sn_fd.FlowAPI.startFlow('your Flow name', inputs);

    } catch (ex) {
        var message = ex.getMessage();
        gs.error(message);
    }
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

SAI VENKATESH
Tera Sage
Tera Sage

Hi @athavichith 

 

Just you can trigger the flow again based upon your conditions mentioned in the flow.

 

Regards,

Sai Venkatesh

Dr Atul G- LNG
Tera Patron
Tera Patron

Particularly, the changes will apply only to the new record.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@athavichith 

once you publish the flow then the changes will apply to new records and not to old ones.

what's your business requirement?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I want to rerun the flow on submitted RITM to generate the catalog tasks. In my previous flow, there was an approval, but now the customer wants to bypass approvals and just generate tasks.