Posted: 27 Mar 2017 11:48 EDT Last activity: 7 Apr 2017 14:06 EDT
Error when using addwork activity
I am trying to use addwork activity in class A to create a work object of Class B .But it is throwing an error saying " cannot/unable to acquire lock on cover object " .Here my cover object is Class A.
Can anyone please help how to resolve this error ?
I could see that activity is running successfully at my end . In the below screenshot, you can observe that pyWorkPage is of class Level-1, and workPage is of class Level-2. Level1 is a child of Level2.
I have ran the activity from Level-1
Can you please provide the screenshot of your configuration ?
Work-AddWork activity will add a new work object using the primary page data. This activity saves the new work object on the deferred list.
Call this activity to create a new work object from a Utility or Post-Processing activity. Prior to calling this activity create and populate a new work object page using Work-createWorkPage activity then use it as the primary page to call this activity. Caller must commit changes using Work-commitWithErrorHandling.
For more understanding you can look into the activities @baseclass-pxAddFeedback or @baseclass-pzTEstAct activities.
If you had followed the same process mentioned above for AddWork then kindly share the tracer file of your usecase for further investigation.
Hi Mahesh and haritha,
In my case Class B is not a child of Class A ...And when setting up the primary page for addwork ...I am setting one property which is taken as a parameter to the flow...That property I am setting to pyWorkPage.pzInsKey ( pyWorkpage will be of Class A) ...It is showing error of not able to acquire lock related to this property
When you trace this, what is happening when the error occurs? I assume you are doing an Obj-Open-By-Handle of the object in Class A. I also assume that object was in a Review harness and not Perform, because if you were on the Perform harness, you should have already acquired a lock. So you may want to trace the opening of the object in Class A, with locking turned on, and continue to trace calling addWork and focus on where locks are acquired/released. And then if you need to manually get a lock before calling addWork, modify your activity to do that.
The error is being set on the page when it comes to the first step of my activity..The first step is page-new where I am defining my workPage for class B. I haven't used obj-opej by handle...But later on a utility on the flow which is to be called when addwork executes does a obj-open by handle which fails . Before my activity is getting called I assume there is somewhere where the lock is being set. What should I do if I manually want to lock the object ?
I'm not sure I follow. You do a page-new and get a locking error? Is the error there BEFORE the first step of your activity? (i.e. is it an old error lingering from something else?) How do you call your activity and did you trace that? Does the cover object exist at the time you're trying to lock it? " cannot/unable to acquire lock on cover object " is your error, which means the system is trying to lock it and can't. Trying to lock an object that isn't in the DB could possibly do that. I think? Normally, if I wanted to lock an object that I already have open, I'd call the method Obj-Refresh-And-Lock. If I didn't have the object already, I'd use an Obj-Open-By-Handle with locking checked.
If you see the error on the beginning (step begin) of the page-new, then it is a leftover from a previous operation.
I suggest you set the logging level to DEBUG (Designer Studio >> System >> Operation >> Logs >> Log Level Settings) for the class lockmanagerimpl and then go through the same operations. You should also have Tracer on and be Tracing lock events as well as activity and activity steps.
You should see in the PegaRULES log file the complete locking history. You may get some additional information stating why the lock cannot be achieved.