Drag parallel workflow and write the below code to launch multiple workflows from the script. The workflow will run individually.

var wf_name='WorkflowName';
coordinator = new WorkflowCoordinator( {workflow:wf_name} );
var list = current.variables.requesting_for;
var listUser = list.toString().split(',');
for (var i = 0; i < listUser.length; i++) {
    var gr = new GlideRecord('sys_user');
    gr.get(listUser[i]);
    var mgr = gr.manager.toString();
  coordinator.add( {nextWFVariable:mgr} );  
}
coordinator;  

Create another subflow and use this variable, use run script and assign that variable value inside scratchpad

workflow.scratchpad.variableName = workflow.variables.variableName;

For more information : https://docs.servicenow.com/bundle/rome-servicenow-platform/page/administer/using-workflows/concept/c_UsingVariablesInAWorkflow.html

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *