I have a requirement to lock a case when it is opened by a user and remain with the case locked unless the same user unlocks it. I have used Pega's built in locking function. Its working properly only sometimes.
When it doesn't work, the case is locked when opened, but the lock is released when the user leaves the case.
I have traced both situations and noticed that, when it works, the trace runs on thread "PS1_Tabthread" and the parameter param.IsDCSPA is set to "false". When the problem occurs, trace is performed on "OpenPortal" thread and param.IsDCSPA is set to "true".
Both situations were tested under the same conditions and seems to happen randomly. I am using Pega 8.1.
It depends on what stage the case is being accessed by users. Some cases have review stages where it might be possible for another user to access it. You can review the case life cycle of each stage and verify at design level.