Wait for condition workflow activity

  • 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 Wait for condition workflow activity

    The Wait for condition workflow activity in ServiceNow pauses a workflow until a specified condition on the current record is met. It continuously evaluates the condition whenever the record is updated, enabling workflows to wait indefinitely for particular criteria to be satisfied by an external event such as a record update. This activity is not intended for waiting on changes made internally by the same workflow; in such cases, a timer activity is recommended to manage delays.

    Show full answer Show less

    Key Features

    • Condition Evaluation: The workflow pauses until all specified conditions—defined via a condition builder or script—evaluate to true on the current record.
    • Scripted Conditions: You can specify a script that sets an answer variable to true to indicate the condition is met.
    • Timeout Option: Allows the workflow to stop waiting after a set duration if the condition is not met, preventing indefinite pauses. Timeout duration can be set in hours, minutes, and seconds, and can respect a specific work schedule.
    • Result Handling: The workflow designer can assign a result value inside the activity’s script which controls when the activity transitions forward.
    • User Context: Condition checks run as the user whose actions caused the condition to be met, ensuring proper access and audit context.

    Activity States

    The activity progresses through several states during execution:

    • Executing: The activity begins running its onExecute function.
    • Waiting: The activity pauses and waits for the condition to be met or an event to restart it.
    • Finished: The activity has completed successfully, with its result value indicating the outcome.
    • Cancelled: The activity or its containing workflow was canceled.
    • Error: A JavaScript error occurred; logs should be reviewed to diagnose issues.

    Practical Considerations for ServiceNow Customers

    Use the Wait for condition activity to build workflows that depend on external record updates before proceeding. This is useful for processes requiring approvals, status changes, or other data-driven triggers outside the workflow itself. To avoid indefinite waiting, enable the timeout option with an appropriate duration. For waiting on internal workflow changes to the same record, incorporate a timer to allow value changes to register before continuing. Monitor activity states and error logs to troubleshoot any workflow pauses or failures effectively.

    The Wait for condition activity causes the workflow to wait at this activity until the current record matches the specified condition.

    The workflow evaluates the Wait for condition activity each time the current record is updated. Use this activity to pause a workflow indefinitely until a particular criteria is met by a record update. To pause a workflow for a timed duration see Timer workflow activities.

    For workflow to consider the condition met, all conditions specified – whether in the builder or in a script – must be true.
    Note:
    A Wait for condition activity should only be used to wait for an external event such as a record update, and not one from a workflow setting a value. If you have a workflow setting a value and want to wait for that same field to be seen as 'changed,' try inserting a one-second timer.

    Results

    The workflow designer can assign a result value using activity.result from within a script field of the activity. The activity transitions when the result value is true.

    Input variables

    The following variables determine the behavior of the activity.
    Note:
    Condition activities run as the user whose actions match the conditions the workflow was waiting for and advances the workflow.
    Table 1. Wait for condition activity input variables
    Field Description
    Condition The workflow is paused at this activity until this condition matches the current record.
    Condition script If specified, the workflow is paused at this activity until this script sets the answer variable to true.
    Enable Timeout Option to limit the amount of time that the workflow waits for the activity to be completed before continuing.
    Note:
    Use the Enable timeout option to prevent this activity from continuing to run. If the condition to continue is never met, a timeout value specifies when the system skips the Wait for Condition activity and goes to the next item in the workflow. You must set a Duration value to enable a timeout. You can also select a Schedule if you want to compute the duration end date based on a specific work schedule.
    Duration Amount of time that the workflow waits before continuing when the Enable timeout option is selected. Enter the time to wait in hours, minutes, and seconds. If you leave this field empty, the workflow does not wait.

    States

    The activity state tells the workflow engine what to do with the activity.
    Table 2. Wait for condition activity states
    State Description
    Executing The workflow engine knows to start the onExecute function of the activity.
    Waiting The workflow engine ignores the activity until a specific event to restart the activity is fired.
    Finished The activity finished running. See the result value for the outcome of the activity.
    Cancelled This activity, or the workflow that contains this activty, was canceled.
    Error A JavaScript error occurred. Review the logs for error details.