ValidateSubflows

  • Release version: Xanadu
  • Updated August 1, 2024
  • 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 ValidateSubflows

    TheValidateSubflowsvalidator in ServiceNow identifies workflows included as subflows that are either inactive, deleted, or not accessible as published workflows for the current user. These invalid subflows cause the main workflow to hang indefinitely, preventing further execution and resulting in a critical error.

    Show full answer Show less

    Key Features

    • Detection of invalid subflows: Identifies subflows that are deleted, unpublished, inactive, or inaccessible due to user permissions.
    • Critical error reporting: Flags conditions where parent workflows become unresponsive because they transition to invalid subflows.
    • Validation outcomes:
      • Valid: The workflow contains only valid subflows.
      • Invalid: The workflow has one or more invalid subflows, with counts provided for clarity.
    • Suggested corrective actions: Remove the invalid subflow link from the parent workflow, ensure the subflow is valid and published, or verify it is checked out to the current user, then re-run validation.

    Troubleshooting

    The validator addresses key scenarios that cause workflow hangs:

    • If a subflow is checked out by User A but the parent workflow is running under User B, and there is no published version available, the workflow will hang because User B cannot execute the unpublished subflow.
    • If a subflow is deleted, unpublished, or inactive, it leads to a similar hang because no valid version exists for any user.

    In these cases, the main workflow logs a critical error in its Workflow Context record. To resolve the issue, either remove the subflow from the parent workflow or publish the subflow to make it accessible for execution by all users.

    Practical Impact for ServiceNow Customers

    Understanding and using the ValidateSubflows validator helps prevent workflow execution failures caused by invalid subflows. This ensures workflows run reliably without unexpected hangs, improves process automation stability, and facilitates troubleshooting by pinpointing the exact subflows causing issues. Customers should regularly validate workflows with subflows, especially after updates or migrations, to maintain workflow integrity and avoid critical runtime errors.

    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.

    Any of these conditions cause the workflow to hang when the workflow activity in the main flow is encountered.
    Warning:
    This is a critical error that prevents a workflow from running.

    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.
    Note:
    You cannot delete a from a list or form workflow that is a subflow. However, you can create one of these unstable conditions with advanced scripting, SQL options, or incomplete update sets that contain main flows, but not the referenced subflows. When troubleshooting a workflow that triggered this validator, consider the history of the subflow while assessing the error condition.