Saturday, 30 June 2018

List of some useful OOTB Pega PRPC functions

Here I will provide the list of some useful functions based on the data types.

Date/DateTime functions:-

addTime(DateTime,calender) from PegaRULES:DateTime library
 
Add an amount of business or calendar time to a DateTime



CurrentDateTime() from PegaRULES:DateTime library

Return the system current DateTime in following format: 20181026T051021.606 GMT


differenceBetweenDate(DateTIme1, DateTIme2, usebusinessdays, Calendarname ) from Pega-RULES:BusinessCalendar library


Calculates the integer number of calendar or business days between a first and a second DateTime value, optionally based on a calendar data instance. This is positive if the first date is later than the second date. A day is defined as 60*60*24 seconds in this calculation.



FormatDateTime(DateTime, format,*,*) from Pega-RULES:DateTime library


For example FormatDateTime(DateTime,"yyyy-MM-dd'T'HH:mm:ss",null,null)



isBusinessDay(date,calendar) from Pega-RULES:BusinessDate library


True if the date is a business day in the calendar identified by the second parameter.


Property Functions:-

IsInPageList(LookFor, LookAt, LookIn) from Pega-RULES:Utilities library 
Searches through the values in a Page List property for a match.  


IsInPropertyList(LookFor, LookIn) from Pega-RULES:Utilities library

Search through the values in a Value List property for a match.

PageExists(pagename, activityname) from  Pega-RULES:Default library

Check whether a page of a specific name already exists, in the context of an activity.

Data Elements in Pega

Pega PRPC handles data through different data elements. As part of our implementation, we create a data model to represent and store different information. The fundamental unit of data model in pega is called "Property". 

There are different property modes in pega for our convenience. For example if we want to store a single piece of information like Name then we use Single Value Property and for a collection of information like Address we use Page. Here is the list of property modes:-

Single Value:- Use to store a single Text , number or Date e.g. "Pega",1234.

Value List:- Use to store ordered list of values e.g. For job history of employee we can use value list to store Job(1)='App Dev', Job(2)='Pega Dev' etc.

Value Group:- Use to store unordered list(like key value pair). e.g. Phone(Home)='1234', Phone(Office)='2345' .

Page :- To store multiple embedded properties e.g. Address Page with properties HouseNo, PinCode, City etc.

PageList:- To store ordered list of pages  e.g. Address(1), Address(2). 

PageGroup:- To store unordered list of pages e.g. Address(Home), Address(Office).

There are also some advanced property type like Java Objects(String,Integer, Class Object) or List of Java Objects.



Create a new application in Pega

Normally in programming languages it takes a lot of time to create a new applications from scratch but in pega we have a wizard to create a new application. So in few clicks we can create a brand new pega application skeleton.
Steps:-
After logging in open the new application wizard in web based pega IDE. Click PegaRULES icon from top toolbar and select "New Application".







There are the following details you have to provide as part of this wizard:-

Basic Information:- Application Name, Description, Org etc.

Business Objectives:- what this application will be used for..

Define Cases:- Here you can provide multiple cases

Define Data:- Provide the data information which will be used to interact with the application

Here you can select  either Implementation only or Framework only or both based on your requirement.
Implementation Only:- Application will created on the top of PegaRULES or the Framework you select.

Framework Only:- It will a create a framework application which can be used to build other application on the top of it.






 
And after providing all the details for each screen you can submit and an application will be created.


Monday, 21 May 2018

Pass/Propagate data from a parent case to child case

Sometime in a case management application where we have one or more subcases for a case, we may need to use some data from a parent case in a child case. e.g. In a 'Request Purchase' case we have one Purchase Order subcase where in the subcase we may need OrderId or PurchaseId from the case. This is called 'Data Propagation'. 
To propagate the data from a case to subcase we need to configure the data propagation on the parent case. The data propagation configuration is available on Details tab of a parent case. Click edit to configure data propagation.
Here we have two options to map the data:-
a. Directly map properties of parent case to the properties of child case
b. Use a data transform

Normally we map the properties but if you need some conditional mapping or more advanced data propagation then you go with data transform. 

Important:- Data Propagation only happens once i.e. when cases are initially created. If you propagate a property from the Parent case to a child case, and the property value later changes on the Parent Case, the property on the child case does not get updated.

Get data from external data sources for pega application

Normally we store data in our application from tables using data pages and access these data in UI using sections. In this post I will explain how to reference external source data in our application. 
There are two ways to do this:-
1. Database Table Class Mapping Tool
2. SQL Connector

The Database Table Class Mapping tool is a inbuilt wizard in pega PRPC which generates all the artifacts needed to reference data in an external database. These artifacts include a data class, a database table instance and a link between those two artifacts.

The SQL connector is advance tool in pega PRPC which is used when you want to write your custom and complex SQL queries to interact with database tables. 

So to summarize, Database Table Class Mapping Tool is very simple method to do this. Before starting this wizard you need to configure the external database in your application. Then decide which table from configured database you want to use. 

Friday, 19 May 2017

Search and replace a string in Pega

Use this OOTB Pega function to search and replace a particular string with another string.

@(Pega-RULES:String).replaceAll("your feed","old chars","new chars")

Monday, 9 May 2016

Add a SLA in a screen flow

A SLA can be added to a screen flow in the process tab of screen flow or you can customize Assign-.NewDefaults OOTB activity.