Saturday, November 4, 2017

To Create File using Connect File

To write a txt/xml file to Service Export directory:

In this post, we will see how to create text file using connect file rule in the "\StaticContent\global\ServiceExport" folder

Below are the steps to follow:










Step1: get the string which need to be written in the file. in our case, small xml string and getting in the parameter.








Step2: In java step, getting the path of the temp folder in a string, which will be passed to the connect file.











try {
     explicitTmpDir  = tools.getSystemSettings().getFSSetting("initialization/explicittempdir", "" , true, false);
if (explicitTmpDir == null || explicitTmpDir.length() == 0) {
explicitTmpDir = "Not Found By Method";
}
}
catch (Exception setCNF) {
explicitTmpDir = "Not Found By Exception: " + setCNF.toString();
}

Step3: setting the temp path string in Test Page.








Step4: Calling the Connect File Method, and Connect File Rule need to be created as follows:








Connect File rule need to be created with the below parameter setting which we set the values in the above activity.



















Please try and let me know the comments if any issues are anything need to be modified.

Friday, November 3, 2017

To Create and Download the file from Service Export

To write a txt/xml file to Service Export and  directory:

In this post, we will see how to create text file using java code in the "\StaticContent\global\ServiceExport" directory.











In step -1: Page new to create a new page for holding the data to be written in the text file.
In step -2: setting the paramters for file name and then xml string or data.
In step -3 below java code need to be added to create text file, in this case XML file is being generated.

java.io.OutputStream outStream = null;
try {
//Whatever the file path is.
//String strFileName="Example_Pega12.xml";
String pathname = tools.findPage("pxProcess").getProperty("pxServiceExportPath").getStringValue() + PRFile.separatorChar + strFileName;
//java.io.File statText = new java.io.File("C:\\Softwares\\examplePega.txt");
PRFile file = new PRFile(pathname);
PROutputStream fileStream = new PROutputStream(file);
outStream = new java.io.BufferedOutputStream(fileStream);
  byte[] outBytes=StrData.getBytes();
//byte buffer2[] = new byte[4096];
outStream.write(outBytes);
outStream.flush();
outStream.close();
}catch (java.io.IOException ioEx) {
oLog.error("Error writing uploaded file to local storage", ioEx);
}

In step 4- @baseclass DownloadFile activity and passing the stringFile name as parameter which we created in step 3, that in turn will have java code to download the file to the browser.

You can try and let us know the comments.

Tuesday, August 8, 2017

About Skin Inheritance

Skin: 
In Pega, to seperate presentation layer and Data layer segragation is done using Skin.
So we no need to change the sections and datas if we need to change the display format.
we need to modify only in the skin.

For every organisation, there will be standards to follow, so that it will be similar across the applications. In normal HTML way, Organization CSS will be applied to the application Level CSS and any changes or customization will be done in the Application Level CSS. Same way to implement in pega we can use Inheritance in Skin rule.

Under Inheritance Tab we can mention, Organisation rule to inherit in the application level Skin. On top of that Organisation skin, some customized style can be added.

For Example, Consider the below Skin as application rule and pyEndUser Skin as Organisation Rule.


In the below image we can see the overridden the style which is mentioned in the application level,

Same way we can add new style in application or if we want to overriden the exisitng skin from Organinzation we can reuse the some of the style which will be as Overridden.



Saturday, May 20, 2017

About Tracer Options in Pega PRPC-2:

Option-1 Setting Break Points:

We will see about setting break points in the activities. This option is very similar to the breakpoints in Java.




Option -2: Setting watch variable:
To watch the variable in some page, so to check in which step what value is getting updated,


After setting the wtach variable for pxUpdateDateTime in pyWorkPage, we will trace and check how and where the date is updated.

We can see when watched variable is changed and it’s highlighted in the step where its updated.

About Tracer Options in Pega PRPC-1

Pages to trace Option in Tracer:

In tracer we can see only the Primary page or step page of that step, we cannot see the other pages values what changes are happening, it will be difficult to get that. So if we want to see the values, then we can use this option "Pages to tracer".


we need to add pages as same as in the images below.


In Tracer, when we trace our activities, then these added pages will be displayed in the tracer as below.

In this pyWorkPage is the Primary or Step Page, and we can see the other two pages which we added in pages to trace.


Note: Please give your comments below, if you have any suggestions.

About Tracer in Pega PRPC

About Tracer Tool in pega PRPC:

While programming what we will feel difficult is to debug the errors or values which is going wrong(either in development or in testing or in any environment).

Pega PRPC has given tools for making developers life easy. Tools such as Tracer, Clipboard and so on.

We will see about the tracer tool here below:

With Tracer, you can see the processing performed during run-time in summary or in detail. view or set the value of watch variables, and drill down to step-by-step details. You can view trace events for any requestor connected to your server node, not just your own session (if you know the connection ID of the session).

In Pega 7, you can see the tracer icon in footer. in Latest version, they are displaying Thread and Requestor id which the are tracing.







By using various Trace options, you can set very fine-grained control over what you wish recorded in the execution trace. You specify the applicable events, break conditions, and targeted RuleSets.


Troubleshooting
Sometimes, you may not see rows that you expect to see in the Trader results display; for example, steps for certain activities. A likely cause of not seeing any steps in the Tracer results is related to the Trace options being applied -- options set in either the Events to Trace or the RuleSets to Trace sections of the Trace Options window.

For example, the Tracer enforces RuleSet access controls.

Tracer output includes information only for rules in RuleSets that are checked in the the RuleSets to Trace section. So if the RuleSet that contains the activity is unselected in the RuleSets to Trace list, that activity's steps do not appear in the results

(Even when you trace a requestor session other than your own, the list of RuleSets you can trace is restricted to those available to your session. You can't use the Tracer to see execution of rules in RuleSets not available to you.)

If you do not see any activity steps in your Tracer results:

In the Events to Trace section, verify that the Start and End check boxes are selected for Activities and Activity Steps.




If you see some activity steps in the Tracer results, but not ones from certain activities:

In the Trace Options window, scroll down to the RuleSets to Trace section and verify that the RuleSets for those activities are selected.





Note: We will see more tracer options and Features in the Other upcoming posts.

Referenced from: https://pdn.pega.com/introduction-tracer-tool/introduction-tracer-tool

Sunday, April 23, 2017

Usage of Requestor Types in Pega

In Pega PRPC, all are built as rules only. Even to display the login screen that sections , HTMLs and UI are built as rules. So how initially we will get access, when we were unauthenticated.

So for this reason, pega had built four different types of Requestor Types, through this it will give access for some basic rules authentication with.
App
Browser
Batch
Portal

about these types in help materials we can find more. Under Sysadmin category --> Requestor type is available.






For Each system name, one requestor type set. because each system can be authenticated 

or accessed differently, so for this reason.

Whenever we are creating a new System name, all these four types will create.
In Pega 7.2.2, Designer Studio --> System --> Settings-->System name.
















To execute which system name or to set the system name as below.
<env name="identification/systemName" value="prpcpe"/>


We can change by setting it in the dynamic data system settings.
Pega-Engine • prconfig/identification/systemName/default

Humans will connect PRPC pega through web browsers only, so browser requestor type we need to check.
In Browser requestor types, pega had created a access group for unauthenticated users.
so if we need to modify login screen or for authentication related any changes need to do, for example, for IAC Authentication or for SSO, or for LDAP to pick our custom authentication activity rules, Our application mentioned access group we need to add in this rule.










Note:
By default 2 0r 3 sets of these requestor type will be available. so dont change all, those which is your system name for that alone you have to change.Because most of the time while doing changes we might miss some changes to do and it will not allow to login. 
We need to be very careful while doing those changes, since to revert that changes without login it will be difficult. 

If we got some error like that then we need to change the system name in the prconfig file.so that other system requestor types will picked up, which is having default one.

We should try not to change "PRPC:Unauthenticated" access group. because this access group is the default one it will be added to all Requestor types.

Thursday, April 6, 2017

To Change Context name in PRPC in Tomcat

Sometimes we will be having many application  or environment URLs like Dev, SIT, UAT and Prod. With URL it will be difficult to find, so we can change the name of the context to identify it easily.

Or sometimes, in same tomcat, we might need to deploy two different Pega PRPC Apps, then we need to change the context of the application.

Say our URL is 
http://localhost:8089/prweb/PRServlet

Need to change this URL to:
http://localhost:8089/<<context name>>/<<App name>>
http://localhost:8089/Test/app


If we want to change context to different name like our application name, then below steps need to follow.

Step 1:
In tomcat folder, Tomcat/webapps we will deploy our "prweb.war" once we start our tomcat, "prweb" folder will get created. Stop the tomcat and then rename the folder to <<context name>>, "Test" as in this case. 

Step 2:
In new renamed, folder under WEB-INF folder, web.xml u can find it.
in this case Tomcat_home/webapps/Test/WEB-INF/web.xml

Step 3:
In web.xml, search with PRServlet name, find the exact match and replace that string with the <<App Name>>, in this case "app".

Before editing:
<servlet-mapping>
                <servlet-name>WebStandard</servlet-name>
                <url-pattern>/PRServlet</url-pattern>
         </servlet-mapping>
<servlet-mapping>
<servlet-name>WebStandard</servlet-name>
<url-pattern>/PRServlet/*</url-pattern>
</servlet-mapping> 

After editing:
<servlet-mapping>
<servlet-name>WebStandard</servlet-name>
<url-pattern>/app</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WebStandard</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>

Step 4:
Start the Tomcat Again and try with the new URL.

Friday, March 24, 2017

Pega PRPC Interview Questions - Part 2

In this post we will see the questions can be asked for Pega Interview in Agents Topics:

1.What are the types of Agents?
2.What is meant by Advanced Agent and Standard Agent?
3.What r the methods used to queue the items for standard agent?
4.Some changes did in the rules are not affecting in standard agent, what could be the reason and how to rectify it?
5.some changes did in the advanced agent is not affecting, what could be the reason and how to rectify it?
6.if large amount of data is there that need to processed, then how u will do it in Standard Agent?
7.Some agents are processing, at that time it got error saying lack of required Access, so what can be the reason?
8.for agents execution, how the rule resolution will work?
9.How u will trace agents? ( Thru SMA, by clicking the query button and in Requestor Management, we will the corresponding agent requestor. Selecting it and Trace it?
10.what are agent schedules?
11.how u will reschedule timing for the agent?
12.if u want to disable whole agent rule what need to do? (below the agent rule enable check box will be there.
13.When executing the activity, agent got error saying "gor error while executing ActivityName because lack of authentication", how u will rectify it? ( bypass authentication Check it)
14.In an application deployed in multiple nodes(say 3 nodes) User is getting every mail 3times? what could be the reason? How will you rectify it? 
15.what is the shortest duration for the agent to execute? how to change that?
16.what are the new options available in latest PRPC version? (Pattern for executing, Advance mode like run in one node, Delay every run by particular run). 

17.In security of agent you can mention Access group for advanced agents, if its not mentioned, then how it will come to know which ruleset version to pick?

Note:if you have some other questions, which u think can be asked, comment below, we will add it up in the post, so it will be useful for others.

Pega PRPC Interview Questions - Part 1

In this post we will see, what are the questions can be asked for Pega PRPC Interview. 
We will see Some Pega topics such as Activity, Declarative Rules and Decision Rules.
Some possible questions are given below Topic wise:

Activity: - Basic level:
1. Name some Obj-Methods?
2. Difference between obj-Open and Obj-Open by handle
3. how u do do exception handling in activity?
4. Diff between Obj-Save and Obj-Save write now option?
5. How do u call Decision table and tree in activity?
6. In obj-browse u will mention class name, what it represents, what is the use of it?
7. What is lightweight results in obj- browse?
8. How u will get a value from page list? give the steps? or how u will identify it has duplicate values?
9. How u will validate the pages, what r the methods used for validating?
10.What is the use of parameters and local variable?
11.What are RDB Methods? When u will use it?
12.If i want a page list in an order, how will u do it? what method is used? (obj-Sort)
13.How u will lock the work object what method u will use it?

Intermediate level:
1.How u will load data page using activity?
2.what is method used to call the actiivty asynchornously, tell some scenario where u can use it?
3.What is the use of Goal Seek property?
3.While calling Desicion table, allow missing property check box is there, what is the use of it?
5.what is the use of May Start or "Allow direct invocation from the client or a service" check box and Require authentication check box?
6.if u want to restrict the user from running activity for particular class of particular use groups, what u should do?
7.how to pass the parameter page to another activity?
8.if u want to make one activity generalised, how u will do it?
10.in which class u will prefereed to write activities and why?
11.what are extension rules?
12.which one is preferred Obj or RDB?
13.when u will use RDB? why?
14.How u will clear the excetion in the activity?what method is used.?

========================================================
Declarative Rules: - Basic
1.what are declarative rules?
2.how to execute that rules? or how we can trigger this declarative rules
3.how to calculate the value of the shipping pricing area?
4.what is fwd chaining and backward chaining?

Intermediate Level:
1.What declare on change and Declare trigger will do?
2.When u will use those?
3.Any example for using declare trigger?
4.How will i capture or track the values of a property in a work object?(declare trigger - pyTrackSecurityChanges for adding history)
5.What will be usage type of activity for this?(Declare type of activity)

======================================================
Decision Rules:
Basic Level:
1.when u will use decision table or Decision Tree give some examples?
2.how u will return more than one value from Decision Table?

Intermediate:
1.How u will delegate Decision Rules or any other  rules to particular users?
2.how u can restrict the values in decision table which they can edit?

Note:if you have some other questions, which u think can be asked, comment below, we will add it up in the post, so it will be useful for others.

Wednesday, March 15, 2017

To Update Pulse Through Email

In the previous Post we saw how to send email when pulse is posted or user is mentioned in the pulse post.
In this post we will see if we reply to the email, then that content will get attached to the Pulse post and if any documents need to attach to the post that also will get attached.

So For this one Email Listener, Service Email are needed.
Email Listener: To Listen to the Email Inbox or particular folder in the Email. If Any mail comes, then it will triger the Service Email Mentioned in the Listener.

Service Email: To Read the Email and Parse the Email and get the From, To, Subject and the Email Conent. In Pega itself sample Service Email has been given, so no need to change anything directly we can save as to that.

So not only for pulse, for any other email listener approach we can refer this email activity. Example, When we raise Support request in pega PDN Support portal. It will read the Subject and parse the work object and attach the email to the Work Object.

Follow the steps in this url:
https://pdn.pega.com/tutorial-enabling-users-respond-pulse-email-notifications/tutorial-enabling-users-respond-pulse

Example after implementing this steps, we will see how it works.


Got mail from pulse once i had mentioned the user in the post, so user is replying to that post and attaching the document with that email. So that is getting attached to thru the Email listener which we configured earlier.


The received document will get attached to the work object attachemnts as shown below.










Along with that it will get attach to the post to which its replied.

Sunday, March 5, 2017

About Pulse Notifications

About Pulse Notifications:

To Get the Notifications when, Pulse messages of Work object are updated, We need to configure as below.

The Details can be get in the below mentioned PDN site:
https://pdn.pega.com/tutorial-configuring-pulse-email-notifications/tutorial-configuring-pulse-email-notifications

Create an email account from which to send notifications by completing the following steps.

1.Click +Create > Integration-Resources > Email Account.
2.In the Account Name field, enter PulseNotifications.

3.Click Create and open.
4.Configure the email account, as appropriate. 
email Config Screen shot.

Example:
In Our example, in the Case Manager Portal, we created a work Object and Opening the Pulse, and mentioned "@" and refer some name and then write some comment in it. So that user whom mentioned in the message will get email Notification.

Application screen shots:





Saturday, March 4, 2017

About Branch ruleset

Need of Banch Ruleset:

Typically, branches are used in development environments in which multiple teams contribute to a single application. You use branches to develop software in parallel in a version-controlled environment. For example, your teams can develop one feature in a branch while another team develops a feature in a different branch, even if they share the same base rulesets. After feature development completes, you can merge the changes you made for both features into the base ruleset. You can also use branches for providing bug fixes, because you can easily add them to applications.

How to create and use Branch ruleset:
Say below is the application u r going to branch














click Add a Branch Link and add Branch ID. This is required for creating branch ruleset.














After Adding the branch ID, we need to create branch ruleset as below.















Each branch can be used by separate teams, so their works can be separated while developing.














Merging the Branch 2 ruleset and checking.














While merging the Branch ruleset to the main ruleset, all will get added to the Main ruleset.
Note: Check the checkbox, if u want the rules and ruleset back. If its unchecked, then all the rules will get deleted along with the ruleset.
In Branch and main ruleset also having Same rule name, so while merging it will give conflict error.














On click of Conflict, u will get below details:


After resolving the issues, click submit button and merge.