locked
What is the best way of locking a Record while a user is working on it in MS CRM 2011 RRS feed

  • Question

  • Hi,

    What is the best way of locking a Record while a user is working on it in CRM 2011? What we want is to disable simultaneous update of a Record.

    I don't want two different users updating the same record at the same time!

    Any help greatly appriciated!!



    Friday, September 28, 2012 6:44 PM

Answers

  • I'd agree with that view in that it would be a bit annoying to prevent 2 users editing a record at the same time. What if 1 user simply wanted to view the record?

    But if you really wanted to achieve this there's many ways to do it. All of which I highly recommend NOT doing. 

    For example, you could introduce your own custom record locking... of which the only way I can think of doing is introducing a "locked by" field on the form linked to the user editing the record. So every time the form is loaded you check if the record is locked by somebody else. If it's not you lock it and then allow the edit. If it's already locked you kick them out of the record. But how do you handle every scenario where you need to unlock the record? What if IE crashes?  The problem here is you could end up with a locked record in the system that nobody has or can open. Also, what if 2 users lock the record at the exact same time? You'd need to handle this too. There are several scenarios here you need to think about.

    So, another way you could try achieve this is possibly by introducing a method similar to time stamping. So if 2 people have a form open the user who saves first get's priority. Basically, every time the user saves the record a piece of JavaScript checks the last modified date on your entity versus the last modified date against the saved entity. If they differ it cancels the save and could tell the user to reload the record as the data is stale. My guess is all this would achieve is annoying users if multiple are trying to edit the record at the same time. Especially if 1 person has edited a large portion of the record only to find somebody else got there before them... so they must re-enter all that data!

    There are many reason why all of this is less than ideal. Another example why: what if one user is editing the address and another user was editing some email addresses, i.e. different parts of the data? What you've done by introducing some kind of locking is stopping them saving, but if you had let them save the 2 users wouldn't have conflicted and never even have noticed (CRM will only save the portion you've edited, it won't overwrite anything else).

    To be honest, I think you'd need a very solid business case as to why you're trying to achieve this. And I'd speculate if changing the work process is what you need, not introducing record locking.


    Wednesday, October 3, 2012 8:43 AM
  • Hi,

    I agree with Conor, look at your business practices before trying to implement a locking mechanism in crm. For example, how about using record ownership more (i.e. implement the security model so users can only update records which they own) or even work from queues so that users 'work on' distinct records rather then stepping on each others toes so to speak.

    Rob


    Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011

    Friday, January 18, 2013 10:19 PM

All replies

  • I don't know of any way of doing this, but why would you want to do this? From an usability point of view you don't want to lock records like that. It can be very annoying for users if they get a message if somebody else has the record opened.
    Saturday, September 29, 2012 9:09 AM
  • I'd agree with that view in that it would be a bit annoying to prevent 2 users editing a record at the same time. What if 1 user simply wanted to view the record?

    But if you really wanted to achieve this there's many ways to do it. All of which I highly recommend NOT doing. 

    For example, you could introduce your own custom record locking... of which the only way I can think of doing is introducing a "locked by" field on the form linked to the user editing the record. So every time the form is loaded you check if the record is locked by somebody else. If it's not you lock it and then allow the edit. If it's already locked you kick them out of the record. But how do you handle every scenario where you need to unlock the record? What if IE crashes?  The problem here is you could end up with a locked record in the system that nobody has or can open. Also, what if 2 users lock the record at the exact same time? You'd need to handle this too. There are several scenarios here you need to think about.

    So, another way you could try achieve this is possibly by introducing a method similar to time stamping. So if 2 people have a form open the user who saves first get's priority. Basically, every time the user saves the record a piece of JavaScript checks the last modified date on your entity versus the last modified date against the saved entity. If they differ it cancels the save and could tell the user to reload the record as the data is stale. My guess is all this would achieve is annoying users if multiple are trying to edit the record at the same time. Especially if 1 person has edited a large portion of the record only to find somebody else got there before them... so they must re-enter all that data!

    There are many reason why all of this is less than ideal. Another example why: what if one user is editing the address and another user was editing some email addresses, i.e. different parts of the data? What you've done by introducing some kind of locking is stopping them saving, but if you had let them save the 2 users wouldn't have conflicted and never even have noticed (CRM will only save the portion you've edited, it won't overwrite anything else).

    To be honest, I think you'd need a very solid business case as to why you're trying to achieve this. And I'd speculate if changing the work process is what you need, not introducing record locking.


    Wednesday, October 3, 2012 8:43 AM
  • We also wish to lock because we find if two or more users are in the same record, and is working on the request, it seems like a waste of time for more then one staff to complete the same work, duplicate work is being done.  As well we find that only the person who gets to the save first on the open record can process, all others really only can read and work they are adding is lost and not saved.  How are you getting around this if you are leaving records open with multiple people working on them? 
    Friday, January 18, 2013 7:17 PM
  • Hi,

    I agree with Conor, look at your business practices before trying to implement a locking mechanism in crm. For example, how about using record ownership more (i.e. implement the security model so users can only update records which they own) or even work from queues so that users 'work on' distinct records rather then stepping on each others toes so to speak.

    Rob


    Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011

    Friday, January 18, 2013 10:19 PM
  • Thanks, we have done both those things...we have several queues but even with those I may have 10-15 people working on that queue.  We also tried the security model so that we have to assign every ticket to ourselves before working on it to become owners.  Two problems, that process takes a few seconds to process when an agent picks up a ticket, so if the work views are not refreshed I easily can have two people pick up the same ticket seconds apart. We are manually setting ownership, and I will look at seeing if  that can be accomplished automatically by CRM.  In the old CRM we had (which was NOT web based), as soon as an agent picked up work, it locked and a message to the next agent picking up the same ticket would pop up.  It did not prevent the second agent from read only access to the request, but it did alert them to the fact someone else was working on it.  Can't seem to duplicate this kind of thing very well in CRM.  Just wondered if anyone has made it work.

    But thanks for your input.

    Tuesday, January 22, 2013 5:09 PM