Call a workflow flow logic

  • Release version: Yokohama
  • Updated January 30, 2025
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Call a workflow flow logic

    TheCall a workflowflow logic allows you to run a published and active workflow directly from within a flow. This integration enables you to pass flow data as inputs to the workflow, such as specifying the current record to be processed. It is designed for ServiceNow customers to coordinate workflows and flows seamlessly, enhancing automation capabilities.

    Show full answer Show less

    Inputs

    • Select a Workflow: Choose a published and active workflow to run. The selected workflow determines the associated records, and if it has inputs, these appear as additional flow inputs. To avoid the workflow running outside Workflow Studio, remove its start conditions. Workflows triggered on the Requested Item table cannot be selected; instead, create a new flow with a Service Catalog trigger.
    • Wait?: Set to true for the flow to pause until the workflow completes, enabling the flow to receive certain output values. Set to false to let the flow continue independently. If the workflow is canceled or its context record deleted before finishing, the flow stops waiting and proceeds.
    • Current: Select the current record that the workflow will process by choosing a data pill from the associated workflow table.

    Outputs

    The flow execution details display workflow output values generated during the flow runtime. When the flow waits for the workflow to finish, all workflow output values are shown. If not, only outputs generated before the flow logic completes are visible. If the workflow finishes after the flow logic completes, output values stop updating and show the last known state.

    • State: Reflects the workflow state from the context record—can be Complete (successful), Canceled, or Invalid (if the context record is deleted before finishing).
    • Context: Reference to the workflow context record.
    • Result: String value containing the workflow result.
    • Return value: String value containing the workflow’s returnvalue.

    Practical Application

    For example, calling the Routine Change workflow with the Wait? option checked causes the flow to pause until the workflow completes. The current record is passed via a data pill representing the triggering record. Execution details include a link to track workflow progress in the Workflow Editor, configuration settings, runtime values, and workflow outputs.

    Important Considerations

    • Do not select workflows that run on the Requested Item table; use a flow with a Service Catalog trigger instead.
    • Removing start conditions from workflows prevents unintended execution outside Workflow Studio.
    • If the workflow is canceled or context record deleted, the flow ceases waiting and continues.

    Related Flow Logic

    This flow logic complements other flow logics such as Assign Subflow Outputs, Do the Following Until, For Each, Make a Decision, Set Flow Variables, Try, Wait for a Duration, and others that help build complex automation scenarios.

    Run a published and active workflow from your flow. You can use the flow data as a workflow input. For example, you can specify the current record as a workflow input.

    Inputs

    Input Description
    Select a Workflow Published and active workflow that you can select to run. The workflow that you select determines the records that are associated with it. If the workflow has inputs, Workflow Studio displays them as additional flow inputs.
    Note:
    • To prevent the workflow from running outside of Workflow Studio, modify it to remove its start conditions.
    • You cannot select a workflow that runs on the Requested Item table. Instead, create a new flow with a Service Catalog trigger.
    Wait? Workflow that you set to true so that the flow waits for workflow completion before continuing. Only workflows that wait for completion can return certain output values to the flow. Set to false to continue running the flow separately from the workflow.
    Note:
    If the workflow is canceled or its context record is deleted prior to the workflow finishing, the flow stops waiting and instead continues running.
    Current Current record that the workflow processes. Select a data pill that contains a record from the associated workflow table.

    Outputs

    The flow execution details only display workflow output values that are generated while the flow is running. If you configure the flow to wait for the workflow to finish, the flow execution details can display all workflow output values. If the flow does not wait, the flow execution details only display the workflow output values that were generated before the Call a Workflow flow logic completes. If Call a Workflow completes before the workflow finishes, the workflow output values stop updating and only display the last known value.

    Output Description
    State State of the workflow. This value comes from the workflow context record. The state will be Complete if the workflow executes successfully. If the workflow is canceled, the workflow state is set to Canceled. If the context record is deleted prior to the workflow finishing, the workflow state is set to Invalid.
    Context Reference to the workflow context record.
    Result String that contains the result from the workflow. This value comes from the workflow context record.
    Return value String that contains the return_value from the workflow. This value comes from the workflow context record.

    Calling the Routine Change workflow

    In this example, the flow calls the Routine Change workflow. The Wait? option is checked, so the flow pauses until this workflow completes. The Current field is filled using a data pill representing the record that triggered this flow.

    Call a workflow logic configured to call the Routine Change workflow and wait for it to complete.

    Execution details

    Figure 1. Call Workflow execution details
    Example Flow execution details page of a flow including a Call a Workflow flow logic.
    1. The header displays a link so that you can view the workflow progress in the Workflow Editor, the flow logic state, the start time, and the runtime duration.
    2. The Workflow Configuration section displays how the flow logic was configured for this flow and the runtime values that were generated.
    3. The Workflow Output section displays the output that is generated by the workflow while the flow is running.
    Note:
    If you cancel the workflow or delete the context record prior to the workflow finishing, the flow logic state is set to Complete.