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:

Sunday, 17 May 2020

How to Create a new Operator ID using Activity



Hi Friends, today we will see how to create an operator id using an activity in pega. 

Pega has builtin activity named CreateOperator  . This activity has some parameters that is required to create operator id we have to provide those values.

Lets see how to do that.


Created a simple flow, in the first assignment we are getting personal information. In the utility we are generating operator id.

Simple flow

We need to save as Pega built in activity CreateOperator to our application ruleset with different name because this activity has availability Final

And also we have to remove the last 2 steps (show-property) after saved as the activity to our ruleset.
Create Operator Utility


Saved as the activity to my ruleset and changed the name. In the below image you can see I removed two show-property methods.

Create New Operator


Parameters required to this activity:

We have to provide all the required parameters.
Parameter Tab of Create Operator activity


Created another activity in that I have set all the required parameters below that called the CreateNewOperator activity.

For the CreateNewOperator activity I have enabled Pass current parameter check box so that all the parameters in this steps will flow into that activity.
parameter set


Above activity is the utility that I have called after the assignment in the flow.


Lets run the case and check.

Provided all the details in the first assignment.

Case

First assignment got completed.

assignment completed

So lets check operator id has created or not

OperatorID Instance


Operator Id Created!

Thank you guys for reading , Ask in comment if you have any doubts.