Call a workflow flow logic
Summarize
Summary of Call a workflow flow logic
The Call a workflow flow logic lets you run a published and active workflow directly from your flow in ServiceNow. This integration allows you to use the flow's data as input to the workflow, enabling you to automate complex processes seamlessly by linking flows and workflows.
Show less
Inputs
- Select a Workflow: Choose an active, published workflow to run. Inputs defined in that workflow appear as additional inputs in your flow. Note that workflows with start conditions should be modified to prevent running outside Workflow Studio.
- Wait?: Determines if the flow pauses until the workflow completes. Setting this to true enables the flow to receive complete output values from the workflow. If false, the flow continues independently, and partial output values may be available.
- Current: Specify the current record for the workflow to process by selecting a data pill representing a record from the associated workflow table.
Important: Workflows that run on the Requested Item table cannot be selected. Instead, create a new flow with a Service Catalog trigger.
Outputs
The flow provides workflow output values during execution with details including:
- State: The current state of the workflow context record (e.g., Complete, Canceled, or Invalid if the record is deleted).
- Context: A reference to the workflow context record.
- Result: A string result from the workflow context.
- Return value: A string containing the workflow's returnvalue.
If the flow waits for workflow completion, all output values are available; otherwise, only outputs generated before the flow logic completes are shown.
Practical Use Case
For example, calling the Routine Change workflow from a flow with the Wait? option enabled will pause the flow until the workflow finishes. The Current field uses the triggering record's data pill. Execution details provide links to view workflow progress, configuration, and outputs directly.
Additional Notes
- If the workflow is canceled or the context record is deleted before completion, the flow stops waiting and continues.
- The flow logic state becomes Complete if cancellation or deletion occurs prematurely.
Related Flow Logics
This flow logic complements other flow logics such as Assign Subflow Outputs, Do the Following Until, For Each, Make a Decision, Set Flow Variables, and Wait for a Duration, enabling complex and dynamic flow orchestration.
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:
|
| 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.
Execution details
- 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.
- The Workflow Configuration section displays how the flow logic was configured for this flow and the runtime values that were generated.
- The Workflow Output section displays the output that is generated by the workflow while the flow is running.