• One Response

    How to prevent multiple users from modifying the same record at the same time programmatically?

    Introduction

    As we know, Dynamics CRM is used by multiple users. So the possibility of modifying the same record at a time is very high. This can result into inconsistent data.

    Solution

    We can avoid this with the help of concurrency control mechanism using RowVersion property.

    Example

    Below is a code implementing concurrency control mechanism:-

    Now, if the name of the record is changed in CRM at the same time by a different user, before UpdateRequest is executed. Then, service.Execute() will give an Exception: “The version of the existing record doesn’t match the RowVersion property provided.” and it would not be executed successfully.

    If you want to forcibly perform the Update operation through code, then, simply change this line as mentioned below:

    updateReq.ConcurrencyBehavior = ConcurrencyBehavior.AlwaysOverwrite;

    In the same way, concurrency control can be maintained, while deleting the record using DeleteRequest as mentioned below:

  • Subscribe
    Notify of
    guest
    1 Comment
    Oldest
    Newest Most Voted
    Inline Feedbacks
    View all comments
    trackback

    […] post How to prevent multiple users from modifying the same record at the same time programmatically? appeared first on Nebulaa IT […]

WANT QUICK D365 IMPLEMENTATION?

Let started with our D365 Quickstart package and get onboard within 7 days!

I'M INTERESTED!
LATEST POSTS
© Copyright 2024 Nebulaa IT Solutions LLP. All Rights Reserved.
Download
Brochure