Skip to content

Commit 8891646

Browse files
author
ecfan
committed
Draft updates
1 parent 774bbe3 commit 8891646

18 files changed

Lines changed: 69 additions & 73 deletions

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

Lines changed: 69 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ Azure Logic Apps includes the following loop actions that you can use in your wo
3232

3333
## For each
3434

35-
The **For each** action repeats one or more actions on each array item and works only on arrays.
36-
37-
Here are some considerations to remember when you use a **For each** action:
35+
The **For each** action repeats one or more actions on each array item and works only on arrays. The following list contains some considerations for when you want to use a **For each** action:
3836

3937
* The **For each** action can process a limited number of array items. For this limit, see [Concurrency, looping, and debatching limits](../logic-apps/logic-apps-limits-and-config.md#looping-debatching-limits).
4038

@@ -144,7 +142,7 @@ Follow the steps based on whether you create a Consumption or Standard logic app
144142

145143
## For each action definition (JSON)
146144

147-
If you're working in your workflow's code view, you can define the `Foreach` loop in your workflow's JSON definition instead, for example:
145+
If you're working in code view, you can define the `For_each` action in your workflow's JSON definition, for example:
148146

149147
``` json
150148
"actions": {
@@ -204,10 +202,9 @@ By default, the iterations in a **For each** loop run at the same time in parall
204202

205203
---
206204

207-
### For each action definition (JSON): Run sequentially
205+
## For each action definition (JSON): Run sequentially
208206

209-
If you're working with your workflow's JSON definition, you can use the `Sequential` option by adding the
210-
`operationOptions` parameter, for example:
207+
If you're working in code view with the `For_each` action in your workflow's JSON definition, you can use the `Sequential` option by adding the `operationOptions` parameter, for example:
211208

212209
``` json
213210
"actions": {
@@ -227,113 +224,112 @@ If you're working with your workflow's JSON definition, you can use the `Sequent
227224

228225
## Until
229226

230-
To run and repeat actions until a condition gets met or a state changes, put those actions in an "Until" loop. Your logic app first runs any and all actions inside the loop, and then checks the condition or state. If the condition is met, the loop stops. Otherwise, the loop repeats. For the default and maximum limits on the number of "Until" loops that a logic app run can have, see [Concurrency, looping, and debatching limits](../logic-apps/logic-apps-limits-and-config.md#looping-debatching-limits).
227+
The **Until** action runs and repeats one or more actions until the required specified condition is met. If the condition is met, the loop stops. Otherwise, the loop repeats. For the default and maximum limits on the number of **Until** actions or iterations that a workflow can have, see [Concurrency, looping, and debatching limits](logic-apps-limits-and-config.md#looping-debatching-limits).
231228

232-
Here are some common scenarios where you can use an "Until" loop:
229+
The following list contains some common scenarios where you can use an **Until** action:
233230

234231
* Call an endpoint until you get the response you want.
235232

236-
* Create a record in a database. Wait until a specific field in that record gets approved. Continue processing.
233+
* Create a record in a database. Wait until a specific field in that record gets approved. Continue processing.
237234

238-
Starting at 8:00 AM each day, this example logic app increments a variable until the variable's value equals 10. The logic app then sends an email that confirms the current value.
235+
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.
239236

240237
> [!NOTE]
241-
> These steps use Office 365 Outlook, but you can
242-
> use any email provider that Logic Apps supports.
243-
> [Check the connectors list here](/connectors/).
244-
> If you use another email account, the general steps stay the same,
245-
> but your UI might look slightly different.
238+
>
239+
> This example uses Office 365 Outlook, but you can use [any email provider that Azure Logic Apps supports](/connectors/).
240+
> If you use another email account, the general steps stay the same, but your UI might look slightly different.
246241
247-
1. Create a blank logic app. In Logic App Designer,
248-
under the search box, choose **All**. Search for "recurrence".
249-
From the triggers list, select this trigger: **Recurrence - Schedule**
242+
### [Consumption](#tab/standard)
250243

251-
![Add "Recurrence - Schedule" trigger](./media/logic-apps-control-flow-loops/do-until-loop-add-trigger.png)
244+
1. In the [Azure portal](https://portal.azure.com), create a Consumption logic app resource with a blank workflow.
252245

253-
1. Specify when the trigger fires by setting the interval, frequency,
254-
and hour of the day. To set the hour, choose **Show advanced options**.
246+
1. In the designer, [follow these general steps to add the **Recurrence** built-in trigger named **Schedule** to your workflow](create-workflow-with-trigger-or-action.md?tabs=consumption#add-trigger).
255247

256-
![Set up recurrence schedule](./media/logic-apps-control-flow-loops/do-until-loop-set-trigger-properties.png)
248+
1. In the **Recurrence** trigger, specify the interval, frequency, and hour of the day for the trigger to fire.
257249

258250
| Property | Value |
259-
| -------- | ----- |
260-
| **Interval** | 1 |
251+
|----------|-------|
252+
| **Interval** | 1 |
261253
| **Frequency** | Day |
262254
| **At these hours** | 8 |
263-
|||
264255

265-
1. Under the trigger, choose **New step**.
266-
Search for "variables", and select this action:
267-
**Initialize variable - Variables**
256+
To add the **At these hours** parameter, open the **Add new parameter** list, and select **At these hours**, which is available only after you set **Frequency** to **Day**.
257+
258+
![Screenshot shows Azure portal, Consumption workflow designer, and Recurrence trigger parameters with selected option for At these hours.](./media/logic-apps-control-flow-loops/do-until-trigger-consumption.png)
259+
260+
When you're done, the trigger information box looks like the following example:
268261

269-
![Add "Initialize variable - Variables" action](./media/logic-apps-control-flow-loops/do-until-loop-add-variable.png)
262+
![Screenshot shows Azure portal, Consumption workflow, and Recurrence trigger parameters set up.](./media/logic-apps-control-flow-loops/do-until-trigger-complete-consumption.png)
270263

271-
1. Set up your variable with these values:
264+
1. Under the trigger, [follow these general steps to add the **Variables** built-in action named **Initialize variable** to your workflow](create-workflow-with-trigger-or-action.md?tabs=consumption#add-action).
272265

273-
![Set variable properties](./media/logic-apps-control-flow-loops/do-until-loop-set-variable-properties.png)
266+
1. In the **Initialize variable** action, provide the following values:
274267

275268
| Property | Value | Description |
276-
| -------- | ----- | ----------- |
277-
| **Name** | Limit | Your variable's name |
278-
| **Type** | Integer | Your variable's data type |
279-
| **Value** | 0 | Your variable's starting value |
280-
||||
269+
|----------|-------|-------------|
270+
| **Name** | Limit | Your variable's name |
271+
| **Type** | Integer | Your variable's data type |
272+
| **Value** | 0 | Your variable's starting value |
281273

282-
1. Under the **Initialize variable** action, choose **New step**.
274+
![Screenshot shows Azure portal, Consumption workflow, and parameters for built-in action named Initialize variable.](./media/logic-apps-control-flow-loops/do-until-loop-variable-properties-consumption.png)
283275

284-
1. Under the search box, choose **All**. Search for "until",
285-
and select this action: **Until - Control**
276+
1. Under the **Initialize variable** action, [follow these general steps to add the **Control** built-in action named **Until** to your workflow](create-workflow-with-trigger-or-action.md?tabs=consumption#add-action).
286277

287-
![Add "Until" loop](./media/logic-apps-control-flow-loops/do-until-loop-add-until-loop.png)
278+
1. In the **Until** action, provide the following values to set up the stop condition for the loop.
288279

289-
1. Build the loop's exit condition by selecting
290-
the **Limit** variable and the **is equal** operator.
291-
Enter **10** as the comparison value.
280+
1. Select inside the leftmost box named **Choose a value**, which automatically opens the dynamic content list.
292281

293-
![Build exit condition for stopping loop](./media/logic-apps-control-flow-loops/do-until-loop-settings.png)
282+
1. From the list, under **Variables**, select the variable named **Limit**.
294283

295-
1. Inside the loop, choose **Add an action**.
284+
1. From the middle operator list, select the **is equal** operator.
296285

297-
1. Under the search box, choose **All**. Search for "variables",
298-
and select this action: **Increment variable - Variables**
286+
1. In the rightmost box named **Choose a value**, enter **10** as the comparison value.
299287

300-
![Add action for incrementing variable](./media/logic-apps-control-flow-loops/do-until-loop-increment-variable.png)
288+
![Screenshot shows Consumption workflow and built-in action named Until with finished stop condition.](./media/logic-apps-control-flow-loops/do-until-loop-settings-consumption.png)
301289

302-
1. For **Name**, select the **Limit** variable. For **Value**,
303-
enter "1".
290+
1. Inside the **Until** action, select **Add an action**.
304291

305-
![Increment "Limit" by 1](./media/logic-apps-control-flow-loops/do-until-loop-increment-variable-settings.png)
292+
1. In the **Choose an operation** search box, [follow these general steps to add the **Variables** built-in action named **Increment variable** to the **Until** action](create-workflow-with-trigger-or-action.md?tabs=consumption#add-action).
306293

307-
1. Outside and under the loop, choose **New step**.
294+
1. In the **Increment variable** action, provide the following values to increment the **Limit** variable's value by 1:
308295

309-
1. Under the search box, choose **All**.
310-
Find and add an action that sends email,
311-
for example:
296+
| Property | Value |
297+
|----------|-------|
298+
| **Name** | Select the **Limit** variable. |
299+
| **Value** | **1** |
300+
301+
![Screenshot shows Consumption workflow and built-in action named Until with Name set to the Limit variable and Value set to 1.](./media/logic-apps-control-flow-loops/do-until-loop-increment-variable-consumption.png)
312302

313-
![Add action that sends email](media/logic-apps-control-flow-loops/do-until-loop-send-email.png)
303+
1. Outside and under the loop, [follow these general steps to add an action that sends email](create-workflow-with-trigger-or-action.md?tabs=consumption#add-action).
314304

315-
1. If prompted, sign in to your email account.
305+
This example continues with the **Office 365 Outlook** action named **Send an email**.
316306

317-
1. Set the email action's properties. Add the **Limit**
318-
variable to the subject. That way, you can confirm the
319-
variable's current value meets your specified condition,
320-
for example:
307+
1. In the email action, provide the following values:
308+
309+
| Property | Value | Description |
310+
|----------|-------|-------------|
311+
| **To** | <*email-address\@domain*> | The recipient's email address. For testing, use your own email address. |
312+
| **Subject** | **Current value for "Limit" variable is:** **Limit** | The email subject. For this example, make sure that you include the **Limit** variable to confirm that the current value meets your specified condition: <br><br>1. Select inside the **Subject** box so that the dynamic content list appears. <br><br>2. In the dynamic content list, next to the **Variables** section header, select **See more**. <br><br>3. Select **Lmiit**. |
313+
| **Body** | <*email-content*> | The email message content that you want to send. For this example, enter whatever text you want. |
314+
315+
When you're done, your email action looks similar to the following example:
316+
317+
![Screenshot shows Consumption workflow and action named Send an email with property values.](./media/logic-apps-control-flow-loops/do-until-loop-send-email-consumption.png)
318+
319+
1. Save your workflow.
320+
321+
### [Standard](#tab/standard)
322+
323+
---
321324

322-
![Set up email properties](./media/logic-apps-control-flow-loops/do-until-loop-send-email-settings.png)
325+
### Test your workflow
323326

324-
| Property | Value | Description |
325-
| -------- | ----- | ----------- |
326-
| **To** | *\<email-address\@domain>* | The recipient's email address. For testing, use your own email address. |
327-
| **Subject** | Current value for "Limit" is **Limit** | Specify the email subject. For this example, make sure that you include the **Limit** variable. |
328-
| **Body** | <*email-content*> | Specify the email message content you want to send. For this example, enter whatever text you like. |
329-
||||
327+
1. To manually test your logic app, on the designer toolbar, select **Run Trigger** > **Run**.
330328

331-
1. Save your logic app. To manually test your logic app,
332-
on the designer toolbar, choose **Run**.
333329

334-
After your logic starts running, you get an email with the content that you specified:
330+
After your workflow starts running, you get an email with the content that you specified:
335331

336-
![Received email](./media/logic-apps-control-flow-loops/do-until-loop-sent-email.png)
332+
![Received email](./media/logic-apps-control-flow-loops/do-until-loop-sent-email.png)
337333

338334
<a name="prevent-endless-loops"></a>
339335

Binary file not shown.
Binary file not shown.
Binary file not shown.
12.9 KB
Loading
Binary file not shown.
24.2 KB
Loading
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)