# Logic: Loop Until

Repeats a defined set of workflow actions in a loop, checking after each pass until a specified condition finally becomes true.


> **Availability:** See the [Incident Workflow Actions Overview table](/workflow-actions) for the plans this workflow is available on.

## Description

**Loop Until** is an action that executes a series of actions repeatedly until a condition is met.

## Instructions

1. If you have not done so, follow the instructions to [Create an Incident Workflow](/ai-automation/automation/incident-workflows#create-an-incident-workflow).
2. When the instructions prompt you to [add actions](/ai-automation/automation/incident-workflows#add-actions), select **this action**.
3. Enter the following **Inputs** and click **Save**.
4. Continue following instructions to **Publish** the Workflow.
5. When the action runs, you will see the **Outputs** listed below.

## Inputs

> **Field References:** Fields with the **\{+\}** icon accept [Field References](/ai-automation/automation/incident-workflows#field-references), which can be useful for referencing incident data or outputs created in prior workflow steps. To add Field References, click **\{+\}**, or enter `{{`, and select relevant fields. Refer to the [Field References](/ai-automation/automation/incident-workflows#field-references) article for more information.

<br />

| Name                | Description                                                                        |
| :------------------ | :--------------------------------------------------------------------------------- |
| Condition           | All of the following conditions must be met                                        |
| Delay between loops | Specify the delay between each loop. Delay begins after the last action completes. |
| Maximum loops       | Limit the number of loops. If left blank, defaults to 20.                          |
| Actions             | The actions to repeatedly execute until the condition is met                       |

1. In the section **All of the following conditions must be met**, specify what conditions must be met for loop execution to halt. 

- **Note**: The Loop Until action will not automatically terminate when an incident is resolved. If you’d like to halt a loop at resolution, you should define a condition that specifies: `Field = “Status”, Operator = “Matches”, Value = “Resolved”`.

2. In the section **Delay between loops**, specify how long to delay between each loop of the action. Duration format is `XXd XXh XXm`.

- The minimum value is **5m** and maximum value is **365d**.

3. In the section **Maximum loops**, specify the maximum number of times the loop should executed if the condition has not yet been met.

- The minimum value is 1 and maximum value is 1000.

![Loop until example](/images/kb/24ee3fd2b40fab41b84f297ceb5b8b61a5566ce75d00fe3272dfb3c62aff3f64-a0edd94-loop_until.png)

4. When you are done adding conditions and specifying the delay and maximum values, click **Save**. 
5. Click **Add Action** in the condition to configure the actions that will execute until the condition(s) have been met. Please refer to each action's documentation (available in left menu or via search) for more information.

## Outputs

| Name                | Description                                                            |
| :------------------ | :--------------------------------------------------------------------- |
| Result              | Final status                                                           |
| Result Summary      | Description of the status                                              |
| Condition Satisfied | Whether the loop was ended because the condition was evaluated as true |
| Loops Completed     | How many loops were completed before exiting                           |
| Error               | Brief description that is populated if the action failed               |
