Flow Designer Subflow - Multiple User Approvals from Variable

Sirri
Kilo Sage

Hi Team,

I am working on a ServiceNow Flow Designer requirement and would appreciate guidance on the best approach.

Requirement

I have a hidden catalog variable named approval_managers (Single Line Text).

This variable stores multiple user sys_ids based on business conditions, for example:

62826bf03710200044e0bfc8bcbe5df1,6816f79cc0a8016401c5a33be04be441,5137153cc611227c000bbd1bd8cd2005

I need to:

  1. Read these user sys_ids from the variable.
  2. Trigger approvals to all users represented by those sys_ids.
  3. Ensure all approvers must approve before the process proceeds.
  4. Build this logic within a Subflow.
  5. Return the final approval status back to the Parent Flow through a Subflow output.

    Subflow Design

    Inputs:
    Label                     -  Name                   - Type
    Requested Item -requested_item - Reference to sc_req_item


    Outputs:
    Label                   - Name                      - Type
    Approval result -approval_result -String


    Questions

    1. What is the recommended approach to read multiple user sys_ids from a catalog variable and create approvals for all users?
    2. Should I use:
      • Script Action
      • Flow Logic
      • Custom Action
      • Script Step in Subflow
    3. How should the Subflow output (approval_result) be populated and mapped so that the Parent Flow can consume the result?
    4. Can someone provide a detailed step-by-step solution with screenshots for:
      • Subflow Input Configuration
      • Subflow Output Configuration
      • Script Inputs/Outputs
      • Mapping output values
      • Approval Activity configuration
      • Parent Flow consumption of the Subflow output
    5. If any Script Action or Script Step is required, could you please share a sample implementation and explain where the inputs and outputs should be configured?


    Expected Outcome

    • Multiple user sys_ids are read from the hidden variable.
    • Approval records are created for all users.
    • Workflow waits until all approvers respond.
    • Subflow returns:
      • Approved
      • Rejected
      • Cancelled (if applicable)
    • Parent Flow uses the Subflow output for further processing.

    Any detailed guidance, screenshots, or sample implementations would be greatly appreciated.

    Thank you.

     

3 REPLIES 3

Tejas Adhalrao
Mega Sage

Hi @Sirri ,

I would suggest using Flow Designer's Ask for Approval action inside the Subflow rather than creating approval records manually through a script.

You can follow this approach:

  1. Create a Subflow with requested_item as an input of type Reference to Requested Item (sc_req_item).

  2. Read the approval_managers catalog variable from the Requested Item and split the comma-separated sys_ids.

  3. Use a For Each loop to process the users if needed, or configure the approval action to handle the required approvers.

  4. Configure the approval so that all approvers must approve before the flow continues. Make sure the logic handles rejection as well.

  5. Set the Subflow output approval_result to a String and return the final result, such as Approved or Rejected.

  6. In the Parent Flow, use the Subflow's output pill approval_result in the next condition or action.

I would avoid using a Script Action for this requirement. A Script Step or custom action is only needed if you cannot handle the variable parsing with the available Flow Designer actions.

One important point: if you create a separate approval action for each user inside a loop, check how the flow waits for each approval and handles rejection. You need to ensure the flow does not proceed until all required approvals are completed.

 

If this helped, mark it helpful and accept the solution.

Regards,

Tejas

 

@Tejas Adhalrao ,
Thank you for your response.

If approval_managers is already stored sys id separated by comma If I map to the For each loop that will read directly. for every sys id is that correct? or we need to do something else. 

Please configure subflow & share with snips.

Thank you.

hi @Sirri  ,

Since approval_managers is defined as Array.String in your Action output, you can map it directly to a For Each loop. Each iteration will give you one sys_id.

However, your script must return an actual array, not a comma-separated string. Your current assignment is correct:

outputs.approval_managers = managerArr;

In your Subflow, configure it like this:

  1. Call your custom Action to retrieve the managers.

  2. Add a For Each flow logic and select the approval_managers output pill from your Action as the collection.

  3. Inside the loop, use the current item's value as the manager sys_id.

  4. If you need to trigger approvals for all managers, configure the approval logic so the flow waits for all required approvals before proceeding.

You don't need to split the output again if the Action is returning an array correctly. If your output is instead a comma-separated string, split it into an array before using the For Each loop.

I can't configure the Subflow directly in your instance or capture actual instance screenshots, but the steps above match the output type shown in your screenshot.

 

If this helped, mark it helpful and accept the solution.

Regards, Tejas