Enable Javascript

Please enable Javascript to view website properly

Toll Free 1800 889 7020

Looking for an Expert Development Team? Take two weeks Trial! Try Now

Using Do Until in Power Automate with Dynamics CRM

do until in power automate

Power Automate is no code low code way of automating the repetitive business processes that could involve different apps and systems, be it cloud-based or on-premise. This is made possible through more than 350 different connectors available for all the popular applications out there - Dataverse, Dropbox, SharePoint, OneDrive, Adobe Creative Cloud, Google Calendar, Outlook, etc. and the list keeps growing.

Check the list of connectors here:

https://powerautomate.microsoft.com/en-us/connectors/

And for the applications for which connectors are not available, especially custom applications or legacy applications, you can write a custom connector and register the same and use it the same way.

Steps on how to create a custom connector:

https://docs.microsoft.com/en-us/connectors/custom-connectors/

Now consider a business requirement where you need to loop through multiple records or rows based on certain conditions and take action on it.

In such a scenario you can make of Do Until function.

Here Microsoft Dynamics CRM Development Team explains how the Do until looks like

image1

The first thing you do in the Do Until specifies the condition that must be true to come out of the loop.

For example, you can specify the condition that it should come out of the loop when the status of a record is marked as completed.

image2

Apart from the condition, we can specify Change Limits.

It can be of two types either Count or Timeout.

image3

By default, Count is set to 60, which means that loop will execute a maximum of 60 times if the loop condition is not met.

Do until loop action allows a maximum of 5000 counts. For example, if you specify the Count to be greater than 5000 we will get the below error.

“The provided 'until' limit count value '100000' is not valid. The count must be a positive integer no larger than '5000'”

image4

Similarly to the Count property, we can specify the Timeout value to stop the loop if the loop condition is not met.

By default, its value is PT1h, which means 1 hour. It accepts ISO8601 format. So basically flow will timeout after 1 hour if the loop condition is not met.

ISO8601 format can be defined as follows

P(n)Y(n)M(n)DT(n)H(n)M(n)S

You can either define both the Count and Timeout limit or at least one of them.

image5

In case, if you want to loop for a fixed amount of time, then instead of specifying the condition based on a specific field’s value, you can make us of a variable. You can initialize the variable, and check for its value in the condition part of the Do Until action and increment it within the Do Until.

image6

You can also use Delay and Delay Until within the Do Until to introduce a delay in the flows.

image7

Thus we covered the usage as well as different properties of the Do Until function in Power Automate and learned how we can use it for performing certain actions either a fixed number of times or till the condition is met.

Recent Blogs

Categories

NSS Note
Some of our clients
team