Saturday, 1 July 2023

How to check a class has lock enabled or not using function in Pega

 Hi Friends, we all know how to update an instance using activity.


If a class is lock enabled ,we have to open the instance with lock and then we have to update.

If a class is not lock enabled, without using lock we can open and update.


Now, if I wants to know whether the class has lock enabled or not at runtime, how to know that?


In Pega we are having a function isPageClassLockChecked to achieve this, lets see how to use this in our activity.

We have to use the function like below.


@isPageClassLockChecked(tools,ExamplePage)


This is a data class where Allow locking is enabled.



Below are the records in the table, we try to update the instance in this table.



In the activity, we used this function to check the class has Allow locking enabled or not at runtime, if it is enabled, we are taking lock on the page using Obj-Refresh-And-Lock method.



In Tracer, we can able to see the when condition becomes true, since the class has Allow locking enabled.


Hope this helps during our development. Thank you!


To know more on Obj-Refresh and Lock method, go through the below article

https://docs-previous.pega.com/reference/87/obj-refresh-and-lock-method

No comments:

Post a Comment