ValidateSubflows
Summarize
Summary of ValidateSubflows
The ValidateSubflows validator identifies subflows within workflows that are inactive, deleted, or unavailable as published workflows for the current user. Such conditions cause workflows to hang indefinitely at the subflow activity, preventing further execution. This is a critical error that must be resolved to enable workflow completion.
Show less
Key Features
- Detection of invalid subflows: Flags subflows that are deleted, inactive, or unpublished for the current user.
- Validation results: Provides clear messages indicating the count of valid and invalid subflows within a workflow.
- Critical error identification: Marks workflows as invalid if they include problematic subflows, which are non-publishable and non-runnable until fixed.
- Contextual logging: Logs critical errors in the workflow’s Workflow Context record to facilitate troubleshooting.
Troubleshooting and Suggested Actions
The validator addresses two main failure scenarios:
- Checked-out subflows: If a subflow is checked out by one user but run as part of a parent workflow by another user without a published version, the workflow will hang. The recommended fix is to either publish the subflow or remove its reference from the parent workflow.
- Deleted or inactive subflows: If subflows are deleted or all versions are inactive or unpublished, the parent workflow cannot proceed. This state may arise from advanced scripting, SQL changes, or incomplete update sets.
To resolve these issues, customers should:
- Remove or replace invalid subflow links in parent workflows.
- Ensure subflows are published and available to all relevant users.
- Re-run validation after corrections to confirm stability.
Practical Impact for ServiceNow Customers
Understanding and addressing ValidateSubflows errors is essential to prevent workflows from hanging indefinitely, which can disrupt business processes and affect transaction handling. By ensuring all subflows are valid and properly published, customers enable reliable workflow execution and maintain system integrity.
The ValidateSubflows validator detects any workflows included as subflows that are either inactive, deleted, or not available as a published workflow for the current user.
Validation summary
- Risk: A parent workflow that transitions to a deleted subflow hangs indefinitely, with no recovery options.
- Severity Level: Critical
- Valid Result: Valid
- Valid Message: This workflow contains <count> valid subflows.
- Invalid Result: Invalid
- Invalid Message: This workflow contains <invalid count> invalid subflow(s) of <total subflow count> total subflows.
- Suggested Action: Remove the link in the parent workflow to the questionable subflow, examine the subflow to ensure that it is valid and published, or that it is checked out to the current user. After making the correction to the state of the subflow, run the validation again to test your changes.
- Publishable: No
- Runnable: No
- Related Information: Workflows used as subflows
Troubleshooting
When a workflow runs, regardless of whether it is a subflow or a main flow, the script engine determines which version of a workflow should execute, given the current user and workflow conditions. When a workflow is checked out by the same user who is running the workflow, the checked out version is the version that executes. If the user is not the same person who has the workflow checked out, the published version of the workflow executes. If there is no published workflow, no workflow runs.
One scenario addressed by the ValidateSubflows validator is when a workflow:
- Is checked out to User A.
- Is a subflow in a parent workflow being run by User B.
- Has no published alternative to the subflow being run by User B.
When this occurs, the parent workflow runs to the execution of the unpublished subflow and then hangs at that activity, with no means to transition forward. Main flows that encounter this condition in a subflow are not permitted to execute against a current record's transaction. Instead, a critical log entry detailing the subflow's state is added to the current workflow's Workflow Context record. To correct the problem, remove the subflow from the main flow, or publish the subflow so it is available to User B. This allows the workflow to execute on the next appropriate transaction.
Another scenario addressed by the ValidateSubflow validator is when a workflow:
- Is a subflow in a parent workflow being run by any user.
- Has no published alternative to the subflow, because the workflow has been deleted or all versions of the workflow are unpublished or inactive.