The Power Platform tools are often used for various solutions implementation. However, if requirements for concurrency management are present, additional consideration is needed. With multiple users editing the same line or more than one instance of a flow executing simultaneously, conflicts could arise. This can especially be problematic with parallel executions of the Flow, as they can read and write the same records crosswise, leading to significant discrepancies in the resultant data.
To prevent parallel executions of Flow, one can control Concurrency. This can be done in the settings of the Flow's trigger. However, once it's turned on, the setting cannot be reverted back to its original state. Therefore, if the Flow starts several times almost immediately, only the first request will start with the rest waiting in queue until previous requests are complete.
When attempting to allow asynchronous responses due to Concurrency control being turned on, it may cause issues as the execution does not wait for the task to finish, but instead immediately returns information that the execution has been accepted. This means the return value can be empty if it's still in progress, which poses a challenge.
Implementing a custom lock was also considered. This included creating a lock table with a single row in Dataverse. At the beginning of the Flow's execution, the loop would continue until the lock table row is unlocked. Once the lock is released, actual procedures are performed. However, even if the lock value is checked every second, it's possible several executions will pass through the loop.
Flow's Concurrency Control and Canvas Power Apps experienced complications due to parallel executions of Flow. Attempts to resolve these have been made, such as the use of a Response action in place of Respond to a Power Apps or Flow. A key will be passed to Flow as a parameter and a table is created in Dataverse to store values, and a timer checks whether the Flow’s execution is finished and what the returned value is.
The ultimate solution includes creating a new Flow, which is called from Power Apps where its parallelism setting is not touched. This Flow does nothing but start the original Flow, which is then executed one at a time. Finally, the Flow returns the value it received from the parent Flow back to Power Apps.
There are limitations to this solution, including connection issues and timeout problems. The children Flow's actions cannot use the Power App's user's own connections, and Flow's operations are performed using predefined connections, causing potential problems. A connection timeout issue occurs if Power Apps have a response time of more than 120 seconds; as a result, only 12 executions can be in the queue if the Child Flow execution takes 10 seconds.
Additionally, an execution timeout issue occurs if Flow has to wait for a long period to execute the Child Flow. The action ends, retries, and if there are too many retries, the Child Flow might not be executed and the call will fail.
To handle this, Flows need to save status information about potential errors and the final result in their tables. If the connection times out, Power Apps can monitor the Flow's result from the board, informing the user about a successful execution, an error, or a failure to execute. This complicates the overall process.
The text discusses about the Flow and concurrency control in Power Platform’s tools used to implement a wide range of solutions. It states that issues may occur in functionality when managing related concurrency. For example, several users using Canvas Power Apps to modify the same Dataverse line synchronously can lead to overwriting changes. Parallel flow instances may experience similar problems, leading to unexpected final outcomes.
The text then introduces a solution to prevent these issues by limiting Flow’s parallel executions. This is done by turning on the concurrency control in Flow’s settings and setting the maximum number of concurrent flows to one. However, this changes the original setting indefinitely. It should be noted that if numerous flows start at the same time, only the first one will start, with the rest waiting their turn. Ultimately, every user gets to perform, one at a time in order of submission.
Microsoft expert guide, Microsoft Power Platform specialist, Microsoft flow concurrency control, Canvas Power Apps expert, Microsoft Dataverse professional