Question
Centene Corporation
US
Last activity: 10 Jun 2021 12:47 EDT
Testing for locks using isPageLocked(tools, pagename)
I have been struggling with coming up with a solution for disabling a button when the case viewed in recap mode has it's lock held by another. My research thus far has drawn me to the page https://community.pega.com/knowledgebase/articles/application-development/85/object-locking
and the suggestion I see that looks to be what I want is "To test whether a lock is held on a page already on your own clipboard, call the function rule isPageLocked(tools, pagename)."
I have tested this function and the return value has been false even when the lock is definitely held by another operator.
I also noticed that the method used in the function is (tools.getDatabase().getLockManager().isLocked(aPage, info) == true) however in the resources>API Engine>Database>LockManager documentation it is indicated that isLocked is a deprecated method.
There is a suggestion to use lockExists(String, StringMap) instead. is there an OOTB function that uses this method instead? How does one call such a method outside of using a function if that is possible.
@sarah GODFREY Thank you for the suggestion. It appears to be exactly what I was looking for and I will be trying that function out right away. Well, as soon as my tracer begins to cooperate. This WAS exactly what I was looking for and I created a when WhenLockHeldByAnotherOperator which checked if the value of the function was -1, the value that the function passes when the lock IS held by another operator, and was able to reuse that for all the controls I wanted disabled.