As we all know, we need licenses to implement Power Automate. All the users of Microsoft Power platform have limits on the number of requests based on the license they are assigned. The following table defines the number of requests a user can make in 24 hours.
In the above table per flow plan is 250000. It is nothing but the API calls you can make in 24 hours by one license holder of Power Automate. API calls are nothing but all the actions which you use to build your flow. It involves trigger, variables initialization, rest calls to the databases, compose, scope, and mainly everything.
For example, you have created one flow which has 100 actions and this flow runs every 2 minutes and if all the actions are executed in every run, the total API count will be 6000 per hour and 144000 in 24 hours.
However, the upper and lower limit depends on the type of license you have opted for.
Also, the workflow which is idle or in waiting condition expires automatically after 30 days. All these limitations can be handled using few tricks which can be easily implemented and can be modified whenever required.
Methods to reduce the number of runs and timeouts
In this blog, I will describe the methods to control the flow instances so that the API requests will be limited.
Define trigger conditions
Even though the flow has conditions defined, the flow instance runs and checks the conditions. We can avoid the flow to run during the initial trigger conditions itself.
For achieving this, we need to set the Trigger Conditions which are defined in the settings.
For example, if I want to send an email when Contact is created only if Send Email Boolean field is set to yes, I will set this condition under the settings of the trigger step as follows:
1. Create Automated cloud flow using the following options:
2. Right click on the first step which is a trigger condition and click on the Settings.
3. Set the following condition in Trigger Conditions
Using the above settings, along with the record creation trigger, the flow will also check if Send Email flag is set to Yes and then only start the instance of the flow. In this way, we can restrict the flow run.
Manual flow and scheduling – replace waiting flows
The maximum run time for a Power Automate flow is 30 days, this cannot be extended. However, you can implement an approval process that lasts more than 30 days using multiple flows. One flow starts the approval process and a second flow triggers when users approve or reject.
To Avoid the flow from being turned off, you can create a scheduled flow which will run daily and will just pickup such waiting flows. As it is scheduled flow, it will not turn off. Instead of creating flows with waiting condition which may remain in wait condition for longer time, we can have a manual flow which will be controlled by a scheduled flow.
Advanced Error handling using Scope
Scope in Power Automate serves as a try catch block which helps to capture the error and is very useful while designing complex scenarios.
We can have try-catch-finally blocks like C# which can have different set of actions. If something in try scope fails, we can run catch scope to notify someone about the error by using Configure run after setting of the action. Below is the example of a manual flow where we will add scope action.
1. Create a Manual flow and add three Scope actions using a Scope control.
2. Rename the Scopes as try Catch and Finally as follows:
3. Add the action to be executed in Try scope. I have added “Send an Email notification” action.
4. As we want to capture an error which Send Email action of Try scope will capture, we will configure Catch scope to run after the Try block. Select the below setting for Catch Scope.
This step will ensure that once the Try scope will fail, it will run catch Scope to throw an error.
5. Follow the same step for finally scope to configure run after Catch scope as follows:
6. After this step, you can add variables to set the result of Send Email Notification step of Try scope.
In this way, we can capture the error in the cloud flow complex design scenarios using advanced features like Scope action.
Summary
you can use the scope action in Power Automate to handle errors if the flow fails during a run.
Cloud flow run limitations can be overcome by using scheduled flows to run the processes manually on scheduled intervals to avoid Delay action.
Trigger conditions are designed to stop the flow from running if the conditions are not met.