This blog will discuss a proposed implementation of Optimized Concurrency for Model-Driven Apps forms. My implementation is executed on the model-driven app only, using the client API and the new Asynchronous capabilities that the API offers.
I won’t go into the details of my analysis that led to this implementation proposal. However, I was strongly inspired by two blogs, which caught my attention thanks to their level of detail and simple and efficient explanations:
- Optimistic Concurrency in Dynamics 365 Forms by Federico Jousset
- My Attempt to Implement Data Concurrency In Dynamics CRM by Temmy Wahyu Raharjo
DEMO:

How does it work?
As mentioned, the logic is executed on the client side only. In fact, the logic is as follows:
- When the form is loaded. The row version is retrieved and stored in a global variable.
- While saving the form, an asynchronous validation is performed. This consists in retrieving the actual record’s version from the server.
- If this value is equal to the initial row version, then the save is not canceled.
- Otherwise, the save will be canceled, and an error message will be displayed.
- After the form has been successfully saved. The NEW row version is stored in the global variable.
Below is the code used for this implementation. Simply associate the OptimisticConcurrencyForm.OnLoad function with the OnLaod event on a form.
Hope it helps …
One thought on “Optimistic Concurrency in Model-Driven Apps Forms”