How to Call one flow on multiple RITM using script

shweta14
Tera Contributor

How to Call one flow on multiple RITM using script

have requirement to convert workflow to flow designer where we are using below script to call workflow again on recently created RITM.how to use such script on flow designer?

-------------------------------------

var wflw = new Workflow();
        gs.info(wflw.startFlow(wflw.getWorkflowFromName('workflowname'), grRITM, 'update'));//grRITM is RITMs created from workflow script where we have to attach workflow
-------------------------------------
2 REPLIES 2

Aravinda
Tera Contributor

Hi @shweta14

You can use flow action (script) to call your w/f from flow.

Ex:

Aravinda_0-1714111121614.png

 

Hi Arvinda,
Thank you for replying

but have to call flow designer via script not workflow so can't use this script include as well
also tried with code snippet but how to add input condition there?

 startflow: function() {

        try {

            var gr = new GlideRecord('sc_req_item');
          ----------------input condition needed based on to attach flow n recently created RITM---------
            var inputs = {};
            inputs['table_name'] = 'sc_req_item';
            inputs['request_item'] = gr; // GlideRecord of table: sc_req_item

            // Start Asynchronously: Uncomment to run in background.
            // sn_fd.FlowAPI.getRunner().flow('global.flowname').inBackground().withInputs(inputs).run();

            // Execute Synchronously: Run in foreground.
            sn_fd.FlowAPI.getRunner().flow('global.flowname').inForeground().withInputs(inputs).run();

        } catch (ex) {
            var message = ex.getMessage();
            gs.error(message + 'test<<<');
        }