Hi, is it possible to lock a record to avoid overriding the other users data, if

Hi, is it possible to lock a record to avoid overriding the other users data, if two users are in the same form? How can we achieve this functionality in SAIL interfaces.

OriginalPostID-140286

OriginalPostID-140286

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    You could also consider using the @Version JPA annotation within a CDT. This would automatically create a column in your database table to hold a lock Id in a similar way to Tims 'lock table' approach above - there's an excellent discussion and example available if you search here for '@Version JPA Annotation'.
  • We're considering this option, but it's notable that the Write to Datastore smart service doesn't generate any errors in the event of an incorrect version?

    Suggestions on how to handle?

  • It does, it stops with error in the smart service.

    Depending on how the user start to edit the information it helps to add some "lock" flag and you can prevent the users to even try to update. but that still has certain limitations like:

    * if you lock based on the flag and the user had open the record type and then click on the related action they will still been able to try to do it. so, another way to handle this situation is in the scenario that the user were able to query as the very first step to prevent check if the version that the user was looking is actually the last version and if it is then let them continue if it is not them tell the user  to refresh . 

    Hope this helps

    Jose

Reply
  • It does, it stops with error in the smart service.

    Depending on how the user start to edit the information it helps to add some "lock" flag and you can prevent the users to even try to update. but that still has certain limitations like:

    * if you lock based on the flag and the user had open the record type and then click on the related action they will still been able to try to do it. so, another way to handle this situation is in the scenario that the user were able to query as the very first step to prevent check if the version that the user was looking is actually the last version and if it is then let them continue if it is not them tell the user  to refresh . 

    Hope this helps

    Jose

Children
No Data