How do I prevent multiple users from accessing the same quotation ?


I have created an application that contains a list of unique quotations

It should not be possible to be with 2 users in the same quotation  at the same time. If there is an user in the quotation  and someone else wants to approach the same quotation ,  a message will be shown that this quotation is in use by another user.

I hope you might have an approach here that I could follow.

Thanks in advance 


Little bit confuse with words quotations and calculation, are both for same purpose?

If user is updating any quotations and you want that same time other user should not update it. Then you can get the record using getforUpdate method available in entity.

If you want any custom logic, then you need to maintain a flag once any user open the particular quotatation.

Please let me know if missing something or didn't get the requirement correctly.



sorry it is about quotations.

the best solution is a custom logic, when any user opens a quatation thats already in use by someone.

so I think in database in quotation table can take one flag. When any user open any quotation detail page then we set the flag to open. 

The issue with this approach is determining how to reset the flag if someone closes the browser without saving the record. 

Hi Twan, 

Instead of displaying the message when someone opens a quotation that has already been opened by another user, you can write logic to display the message on the Save button and provide the option to cancel or force the update.

Read this document

For this you can write some logic, like when user clicks on save button. First you will check the last update time in database and also save screen open time in a local variable.

When user clicks on save button, just compare both times. If time in database greater than time opened. Show an message to user that this quotation has been updated by some other user and you need to refresh the page. If database time is less than screen open time you can simply save the record and update last update time in Database.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.