Skip to content

Commit 05ba84f

Browse files
Merge pull request #301400 from ecfan/patch-1
Update with Until loop status behavior
2 parents e941827 + cdc41ea commit 05ba84f

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

articles/logic-apps/logic-apps-control-flow-loops.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ ms.suite: integration
66
ms.reviewer: estfan, azla
77
ms.topic: how-to
88
ms.date: 09/13/2023
9-
ms.custom:
10-
- build-2025
119
---
1210

1311
# Add loops to repeat actions in workflows for Azure Logic Apps
@@ -240,12 +238,41 @@ The following list contains some common scenarios where you can use an **Until**
240238

241239
* Create a record in a database. Wait until a specific field in that record gets approved. Continue processing.
242240

243-
In the following example workflow, starting at 8:00 AM each day, the **Until** action increments a variable until the variable's value equals 10. The workflow then sends an email that confirms the current value.
241+
By default, the **Until** loop succeeds or fails in the following ways:
244242

245-
> [!NOTE]
246-
>
247-
> This example uses Office 365 Outlook, but you can use [any email provider that Azure Logic Apps supports](/connectors/).
248-
> If you use another email account, the general steps stay the same, but your UI might look slightly different.
243+
- The **Until** loop succeeds if all the actions inside the loop succeed, and if the loop limit is reached, based on the run after behavior.
244+
245+
- If all actions in last iteration of the **Until** loop succeed, the entire **Until** loop is marked as **Succeeded**.
246+
247+
- If any action fails in the last iteration of the **Until** loop, the entire **Until** loop is marked as **Failed**.
248+
249+
- If any action fails in an iteration other than the last iteration, the next iteration continues to run, and the entire **Until** loop isn't marked as **Failed**.
250+
251+
To make the loop fail instead, you can change the default behavior in the loop's JSON definition by adding the parameter named **`operationOptions`**, and setting the value to **`FailWhenLimitsReached`**, for example:
252+
253+
```json
254+
"Until": {
255+
"actions": {
256+
"Execute_stored_procedure": {
257+
<...>
258+
}
259+
},
260+
"expression": "@equals(variables('myUntilStop'), true)",
261+
"limit": {
262+
"count": 5,
263+
"timeout": "PT1H"
264+
},
265+
"operationOptions": "FailWhenLimitsReached",
266+
"runAfter": {
267+
"Initialize_variable_8": [
268+
"Succeeded"
269+
]
270+
},
271+
"type": "Until"
272+
}
273+
```
274+
275+
In the following example workflow, starting at 8:00 AM each day, the **Until** action increments a variable until the variable's value equals 10. The workflow then sends an email that confirms the current value. The example uses Office 365 Outlook, but you can use [any email provider that Azure Logic Apps supports](/connectors/). If you use another email account, the general steps stay the same, but your UI might look slightly different.
249276

250277
### [Consumption](#tab/consumption)
251278

0 commit comments

Comments
 (0)