Question


SkillStorm
US
Last activity: 28 Aug 2023 13:53 EDT
How to require lock on data record in order to perfrom work
If you have a work object type and a data object type that are directly associated in an exclusive 1-to-1 relationship, then how can you require lock on both objects in order to allow performing work?
I was hoping simply throwing a page message in PerformDefaults would prevent Performing the work but it did not. The work object still opened up into the perform harness, just with a page message already there.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Updated: 14 Aug 2023 16:11 EDT


Infomatics Corp
US
@Hermy64 - Does your data class has Key which can be used as unique identifier? Define Locking on the Locking tab. This option is only available if your class is concrete and doesn't belong to class group.


SkillStorm
US
@Abhilash_K Yes, both the work and data classes have locking enabled. Determining the corresponding data record and attempting to acquire lock on it are all solved problems. The only thing I need help with is how to manually prevent Performing work. We want it to behave the same way as if the work case was locked by another operator where when you try to open an assignment it won't open and instead shows a banner error on the Review harness that the lock is held by another operator.


Bits in Glass
IN
@Hermy64 when locking is defined for data class, pega will take care of your expectation. Multiple users will not be allowed to update same record at a time.
Updated: 15 Aug 2023 13:53 EDT


SkillStorm
US
@Anoop Krishna Let me see if I can clarify by rephrasing. If the current operator tries to open an assignment on the work object but the data object is locked by another user, then we want to stop the current operator from performing the assignment on the work object.
We want performing an assignment on the work object to fail if the current operator cannot also acquire the lock on the data object.


Bits in Glass
IN
@Hermy64 ok got you. Then I think you can check sys_lock table for data table lock exists check, if it's locked you can restrict user to open assignment.


SkillStorm
US
@Anoop Krishna Yes, that is the high level plan. The reason for this post is to get help how to restrict user to open assignment.


Bits in Glass
IN
@Hermy64 I think you could use Opendefault extension activity. There you can add logic for whether lock exists or not and if yes you can do page-set-message.


SkillStorm
US
@Anoop Krishna PerformDefauls is what we would really want but putting a page message there doesn't stop anything. OpenDefaults would be tricky, if possible, because that happens when simply opening the work object into the Review harness (it also runs when performing work) but I tried setting a page message there to see what would happen and it set's the page message but then it gets wiped so it effectively doesn't do anything.


Infomatics Corp
US
@Hermy64 i think you can do the same way how pega is restricting to Perform the work when case is locked by another user. Identify the extension points and plug it in your logic.