How to call script include in flow designer to call flow again

shweta14
Tera Contributor

I have requirement to call flow inside flow and add approval
I am creating multiple RITM based on list collector field and want to add same flow on each RITM to add approval and update record.

added below script include but not working
same script if run in background then it will work

script include :

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

var StartFlow = Class.create();
StartFlow.prototype = {
   // initialize: function() {
        startflow:function() {
   
    try {
        var gr=new GlideRecord('sc_req_item');
        if(gr.get('sys_id')){
       // gr.get('sys_id');
        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.test_for_item').inBackground().withInputs(inputs).run();
               
        // Execute Synchronously: Run in foreground.
        sn_fd.FlowAPI.getRunner().flow('global.test_for_item').inForeground().withInputs(inputs).run();
        }
    } catch (ex) {
        var message = ex.getMessage();
        gs.error(message);
    }
 },
   // },

    type: 'StartFlow'
};
----------------------------------------------

how to achieve this? @Anil Lande 

8 REPLIES 8

how to pass values or input in script include for this flow?
log shows undefined for variable value

you may need to pass it in the function parameter.


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

when i am adding parameter then flow is not getting called

shweta14_1-1714462013823.png

 

 

Community Alums
Not applicable

Hi @shweta14 ,

You have to create one action and in that action you need to create one script type action and in that you need to call script include sample code 

new scriptInclude().functionName();

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak