Friday 22 May 2020

Declare Trigger Rule in Pega

Hi Friends, today we will see the use of declare trigger rule in Pega.


I have a class TGB-HRApps-Work-Candidate, In this class I have created some cases(C-1,C-2 and etc..). 

If Anyone delete any case(assume C-1)  I wants to see information like operator who deleted the case and pzInsKey of the case.

How we can achieve this? 

We can configure declare trigger rule , which will trigger whenever a instance is delete in the class. 

In  trigger activity we can add steps to save those details.

Lets do this practically

In below image we can see the list of case id available in candidate class.

Instance of Work class
.
In the same class I am creating a Declare trigger rule.

Declare trigger rule creation

From the list of option available , I am selecting Commited Save so whenever I am doing delete and commit this declare trigger rule(MonitorDelete) will trigger. 

Declate trigger option

When try to save a error message displayed . It is mentioning that Trigger activity is not of type trigger.

Declare trigger rule error

    Updated the activity type to trigger.
Declare trigger activity type
Now can able to save the rule.

Rule Saved

Created a data class to store the deletion details.
data class

Created 3 properties in this class.

data class property creation

Click on the below highlighted button to create local table .
create table button

Added Key for class.

Added Key for class

So lets configure the trigger activity steps. Below is the list of steps in the activity.

Activity steps

Pages and class tab:

pages and class tab

In the property-Set added the data to save to table.



In the first step we are checking whether pxInsKey has values are not. If it has values then only we are allowing to execute the activity.

when condition



Lets check the work we have done.


Created a sample activity to delete the instance.

deletion activity

















Ran this activity and traced it.

tracer
In the above image you can able to see the declare trigger was triggered on the deletion and its activity got executed.


In the table you can able to view who deleted and which pzInskey got deleted .

rec


Thank you for reading this post.  If you have any doubts please ask in comment.


Reference:

Pega help file:

6 comments:

  1. HI Man, You are Doing a Great Help . It was very easy to under stand when you start explaining the complex things in a easy way. PLease make more posts :)

    ReplyDelete
    Replies
    1. Thank you for your kind words. Will do that.

      Delete
  2. Thank you for your explanation. I need this urgently.

    ReplyDelete