Wednesday 20 March 2019

How to Copy Messages in One Page to Another One Page in Pega

How to Copy Messages in One Page to Another One Page in Pega 

Hi all , During my work I faced one issue and the issue is when I am validating any property that is in Temporary Page , the message is correctly set in temporary page but that message is not displaying in the User Interface. I browsed the PDN , there I got one information and the information is Pega configured to display the messages that we are setting only in pyWorkPage not temporary clipboard page. In this post I will share how to copy the message from Temporary Clipboard page to pyWorkPage.

I created a Flow to get Employee Details in TGB-HRApps-Work Class and the Properties I created in TGB-HRApps-Data-Employee Class , Now If I want to use the properties that I created in Data class to Work Class I need to create one page in Work Class and I have to refer the data class properties using this page.


Reffered the data class property using Page "EmpPage" .


Pages and Class tab of section :


I added validation rule in flow action.

Now our Expectation is on run the flow if I leave the fields blank and then I click submit means it should through Validation Error. Let's check that. 

I created a new case and left all the fields blank , lets click submit button and test whether it shows error message or not. 


I clicked submit button and it not displayed any error message and completed the case.

  

If I checked the clipboard I can able to see page messages in "EmpPage" 



Validation message in clipboard but not displayed to user 

Pega will display message that is available only in pyWorkPage.

 So we have to transfer this message from EmpPage to pyWorkPage. So In Flowaction Post-Processing I added one activity.

 I added activity "PostEmployeeDetails" in Post-Processing 


I added a step to transfer message from Temporary Page to pyWorkPage.



In the step 1 , I added a when condition to check whether EmpPage contains messages using @hasMessages(EmpPage) method , if has message then get the message in EmpPage using @getMessagesAll(EmpPage) using step page as pyWorkPage. In the above activity I not provided the step page name. dynamically pyWorkPage will come as step page. 

Lets check again whether messages are copied to pyWorkPage or not by running the flow.

I am tracing this activity to check the background process.


In user Interface, now I can able to see the Validation Messages.

  

In tracer we can see the messages are available in pyWorkPage. 

Thats it. Hope you understand. 

4 comments: