ValidateSingleEnd

  • Release version: Zurich
  • Updated July 31, 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 ValidateSingleEnd

    The ValidateSingleEnd validator in ServiceNow identifies workflows that contain multiple End activities. While multiple End activities can be intentional for readability or design purposes, they may also indicate design errors that impact workflow execution.

    Show full answer Show less

    Key Features

    • Detection of multiple End activities: The validator flags workflows with more than one End activity, providing a warning to review workflow design.
    • Validation results:
      • Valid: When there is a single End activity.
      • Invalid: When multiple End activities exist, with a message specifying the count.
    • Risk identification: Highlights potential issues if execution paths to End activities are not mutually exclusive, which can cause premature workflow termination and cancellation of other ongoing activities.
    • Suggested action: Remove unnecessary End activities unless their presence is intentional and well-structured.

    Practical Implications for ServiceNow Customers

    When multiple End activities exist in a workflow, the first End encountered during execution completes the workflow and cancels any other active paths. This behavior can cause unintended cancellations if execution paths overlap.

    Workflows with mutually exclusive execution paths leading to multiple Ends are safe and can improve readability, especially in large workflows. For example, different branches that do not run concurrently can each have their own End activity without risk.

    However, when execution paths are not mutually exclusive, the workflow may end prematurely, canceling other activities still in progress. This often indicates a design flaw where activities expected to complete before termination do not do so. In such cases, using a Join activity to synchronize paths before a single End is recommended to ensure all activities finish properly.

    Best Practices

    • Use a single End activity whenever possible to guarantee all intended activities complete before workflow termination.
    • If multiple Ends are required for clarity, ensure execution paths to these Ends are mutually exclusive to avoid unexpected cancellations.
    • To add multiple Ends, copy and paste the original End activity onto the canvas, but validate design carefully.

    The ValidateSingleEnd validator finds and identifies multiple End activities in a single workflow.

    Multiple End activities in a workflow might be intentional and have no affect on the workflow, or might be a mistake that the designer needs to correct.

    Validation summary

    • Risk: If the execution paths to the End activities are not mutually exclusive, then the first End encountered completes the workflow and cancels all other executing activities.
    • Severity Level: Warning
    • Valid Result: Valid
    • Valid Message: This workflow contains 1 End activity.
    • Invalid Result: Invalid Activity
    • Invalid Message: This workflow contains <count of ends> End activities.
    • Suggested Action: Remove extraneous End activities that are not intended as part of the design.
    • Publishable: Yes
    • Runnable: Yes
    • Related Information: None

    Troubleshooting

    As soon as an End activity is encountered in the workflow, the workflow completes even if there are other viable execution paths leading to a second End activity that is still executing. Those executing activities are canceled as part of the End activity's clean up actions. Therefore, the results of designing workflows with multiple Ends must be carefully considered.

    In the case of large workflows, it is often more intuitive to read the workflow when there are multiple End activities. In the following example, the paths to the two Ends are mutually exclusive execution paths. If this was a large workflow, with many activities between Branch and the second End, the value of the multiple ends becomes apparent. Tracing a No response from User is invalid to a single End behind 33 other activities would be significantly more difficult. There is no risk in this workflow design because there is no reason for other activities to execute if the End after the Notification activity terminates the workflow.

    Figure 1. Mutually exclusive execution paths

    The next example has multiple End activities in execution paths that are not mutually exclusive. A Yes response from User is valid causes the Set Values activity to finish immediately. By reaching its End activity first, this execution path cancels the Approval for Apps and the DB Task activities, which might not be the desired outcome. If the paths are all expected to complete before End, the activities should come to a Join (as in the previous example) that transitions to a single End.

    Figure 2. Mutually inexclusive execution paths
    Note:
    To add the second End, right-click to copy the original End activity and paste it onto the canvas. In most cases, a single End is the best and most reliable way to ensure that all activities expected to execute prior to workflow completion, do so successfully.