Wednesday 29 August 2018

Primary Page in pega

Use of Primary Page in pega


In most of the case we will use Primary page in pega activity. What is the use of Primary page and why we have to use primary page???

Primary page is a page in pega, which refer to the current rule class name.

Now our requirement is to get the employee details for the given employee id. 

How to acheive this?? First we have to create one flow in that flow , in first section we have to get the employee id . In action tab of EmployeeID property we have to post the value to clipboard and then call one activity in that activity we have to use obj-Browse method to get the employee details. 

Lets see how to achieve this.

Our flow look likes

Our section look likes


In the First Dynamic layout we have one Employee ID property to get the employee id . On change we have to post the value to clipboard and then call one activity.



U can ask , Y we have to use Post Value , the answer is to post the property value to clipboard.  Now in our scenario. Once I changed the EmployeeId property with some value that value will be send to clipboard using this Post Value.


Then on change of value in EmployeeID property we are calling one activity "RetrieveEmpDetails"

there we retrieve employee details.

Now In first step , I created Page-New step to create one page in clipboard with name TempEmpDetails.

TempEmpDetails refer to class where my local data table is there.


In second step, I added Obj-Browse, to retrieve values,

Now I used page Primary. in this time primary refer to "TGB-HRApps-Work", as I told already Primary == class of the rule.(activity is in class TGB-HRApps-Work)

So in run time EmpID is refered from pyWorkPage , this is because pyWorkPage is also refer the current rule class .

Now we run once our flow and check whether our activity works fine or not.


Now lets run the flow.

Now I gave 2 in employee id field. so now see our clipboard whether TempEmpDetails have value or not.


So its working.  I think U understand how to use Primary Keyword in pega activity. Primary refer to class of the rule.

If any Doubt ask in comment 😊

Tuesday 28 August 2018

How to save data to database in pega using activity

How to save data to database in pega using activity


In How to create Local Data table in Pega , we saw how to create local data table in pega. Now we can try to insert data to these table by using activity dynamically.

Now assume , our requirement is to get employee Educational Information and store those details to database, for this we have to create one flow. flow contain 1 section in the first section we are getting the educational information and in the first flow action post condition activity we call one activity  there we store those details to database.
How to create flow in pega

Our First Flow action is
How to create flow action in pega
Our section is
How to create section in pega
Now on running the flow our section will display
How to run flow in pega

Now what we have to do is on clicking the submit we have to store the data to database , fot this we have to write one activity in flowaction post condition activity.
How to add post action activity in pega flow action


Flow action activity in pega

Now our New activity will look like this.
activity in pega

In activity first step we have to wrote is"Page-New", For creating new page in clipboard and storing our data .
Page New in pega
After we add the page here , we must give class for this page , because we have to tell pega which class this class is belongs to . So that only we can acess the property in those class using that page.
Pages and class in pega

Then what we have to do is, we have to refer all the properties from clipboard to our activity,


If u confused about clipboard , note this.. After we give values in section and click submit.  Provided values in section will be store in clipboard , so we can access those value from clipboard to activity .

Now I provide some values in our section and click submit.
After click submit , open clipboard and choose our thread(Choose oru case id in clipboard as thread)
Clipboard thread in pega

Normally our data will be there in pyWorkPage.
pyworkpage in pega

So We can access the values from clipboard . Now lets see our activity.
pyworkpage in activity

In second step , I added one property-Set there I copied all the values from clipboard page(pyWorkPage) to Our Page(TempStoreEmpDetail)

U can ask now, where u mentioned pyWorkPage, the answer is .... I left the step page as blank. so dynamically on the activity run time the page will be pyWorkPage so no need to add there pyWorkPage. so I left that blank.

On the Left side of 2nd step property set we have to mention to which property we have to assign those clipboard values.

We have to give column name of table then only we can save the values to table.
property set in pega activity
Now it will refer the Properties in class TGB-HRApps-Data-EmployeeEducationalInfo because our page TempStoreEmpDetail is reffered to this class.

Now the Third step is to save data in TempStoreEmpDetail to database.

Obj Save in pega
Now we are saving all the data in TempStoreEmpDetails page to datbase, so that only I gave Step Page as TempStoreEmpDetails.


Now check whether our flow and activity works or not by giving values in our section and click submit.

I tried its not worked, because we are not provide EmployeeID, that is primary key for that table, we should provide value then only the data will be stored in database.

So we have to add one value in property set 2nd step. I hard Coded with 3 because already there is 2 records there in database.
Hard code values in pega property set

Now try to run.
insert data in to pega local data base

U can see the values are stored in database, but EmployeeHscPercentage is missing, lets solve this issue and Run once more with Employee ID hard Coded with 4.

The problem is I not mapped that values in property set correct.
Now run once again and test.


Now u can see all the values are filled in table.


If u have any doubt ask in comment 😊

How to create Local Data Table or Local Database in pega

How to create Local Data Table or Local Database in pega


Hi Friends, Today We will see how to create Local Data base or Local Data table in pega. 


Normally all the case information will store in PegaData database., For example, We are running a flow. We are giving some information in the section. Then where all the information will store??

We are not created database , tables, then where it will store? these details will store in PegaData database. the default database provide by pega. We can store up to 1000 records in PegaData  for each Class == Data Table .In pega we are creating the class then automatically table will be assigned for that class. These We will try now.


Now I am going to create one data class.


First click the app explorer,


Generally it shows Work Class structure,  Normally we will create Local Data base in Data Class only so switch to Data Class Structure by replace Work With Data and then enter.. We can create Data Table by using Data Type option also ..I will say later.

Now we can create our Data class by clicking sysadmin->Create -> Class

After clicking the class, this New Rule Window will open here we have to give the class name in the Lable Field and give the same in the Class Name field after "TGB-HRApps-Data-"  


Then click Create and Open.

Select Class type as Abstract, Choose the version, and choose the class hierarchy. Then click Save.


After I clicked one error message in class creation came, 

In history tab, we must provide the Description and usage or else this error will come. then try to save.

Yeah it saved!!


Then refresh the app explorer and see whether our class is added or not.

After creation of class, we can create properties in our class. since class is act as table in pega, properites are act as column in table. so lets start create properties in our class by righ click on our class and Select Create Properties option.
Now data type rule will open, here we can add our properies by clicking add field
After Create properties click add to data explorer, then open Source tab
Here click the Create local Source button, then one pop up box will open there we have to choose one column as key and we can give value alos if we want for 1st record.
On clicking the next button, a review screen will open click close.

Now open the Record tab there we can see our table structure.
We can add records here.

Thats all, we created local data table. If u have any doubt ask in comment 😊

How to Skip New Harness on Running Flow

How to Skip New Harness on Running Flow


Most of the time when I run a flow or Run a Case Type in case designer  I frequently see the "New Harness" before my case open. 


We no need this harness now, so lets try how to skip this new harness .

For this we have to open the Process tab of the flow rule.

In this we to check the Skip Create harness and Change the Work Parties Default to "pyCaseManagementDefault"
After Modification
Now save the rule and Run the flow again. Now you can see my case is directly opened without open new harness.

If any doubt ask in comment ☺