To give inputs and trigger subflow from business rule

shivaadapa
Tera Expert

scenario : In a form having list type field with referring to user table. while insertion of record the field is empty and while updating the record i will give some users which are needed and also i will remove not needed users. 
1. I need to get the user emails for both removed users emails and added users or existed users in field 

2. I have to give those emails as inputs to subflow to trigger and remove access to the folder for all the removed users and grant access to the users who are newly added and existed users.

try {
        var flowAPI = new sn_fd.FlowAPI();
       
        // Define the subflow name or Sys ID
        var subflowSysId = 'collabsubflow';  

        // Create a map of inputs for the subflow
        var inputs = {
            'added_emails': addedEmails.join(','),  
            'removed_emails': removedEmails.join(',')
        };
 
        flowAPI.startSubflow(subflowSysId, inputs);
    } catch (e) {
        gs.error('Error triggering subflow: ' + e);
    }
Anyone help me on this.
1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@shivaadapa 

so what's the issue?

Subflow is not getting triggered or inputs are not being passed?

You can open that subflow and copy the code snippet and use that script in your BR

AnkurBawiskar_0-1736503635899.png

 

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