We have a requirement where in a screen flow in each screen we are giving a Save button to save the values entered by the user in the screen. We do need to persist all the values in the DB in different data tables in order to persist the values since the user may save and exit or log-off and come back later point of time to continue with the screen. For that when user clicks the Save button we are calling activities to do obj-save (Write-Now unchecked) in different data tables and at the end of the activity in the last step doing Call CommitWithErrorHandling. My question is
Does Call CommitWithErrorHandling at the end step releases the lock on the object? Here the step page is "CommitPage" which is an instance of Work- defined in the Pages & Classes tab.
I understand there is an instance of System-Locks for which there is a row in pr_sys_locks for one locked object. However when you explicitly do Call CommitWithErrorHandling or use Commit method or do Write-Now in Obj-Save, does that releases the lock on the object or these three works differently? If using any of them explicitly release the lock on the work object, then in our case please enlighten how to handle the requirement since the last step would release the lock and after that user clicking on the next button won't have the lock of the object and further processing of the flow will stop.
What are the scenarios when lock on work object get released?
Is there any tutorial/write-up on locking in pega? any link on this would be highly appreciated.
Please share your thoughts at the earliest. Thanks in advance.
Yes you are right, Commit step method or CommitWithErrorHandlingactivity will release the lock if being called explicitly and their operation is successful.
Whenever a work object is committed in DB, lock is released by PRPC. Lock is help for records opening in editable mode to ensure data integrity. However PRPC has provided optimistic locking feature to provide lock on object following FCFS method. Pls follow Pega Academy courses (SSA and LSA) to understand more on locking mechanism.