Logo
  • Products
    • SecOps Studio
  • Solutions
    • Pega Stack Shifter
  • Services
    • Pega Enablement
    • Pega Modernization
  • About
  • Contact
  • Blog
Code Vault

Notifications in Pega – Part 4 – Read published message

December 10, 2024 Code Vault Curators

In this blog article, we will see how Pega Subscribers can read the published event messages

This is the continuation of the previous article, where we published a custom notification message as soon as the case is assigned to the Sales Work basket.

Please go through the article series in order number for better understanding.

https://myknowtech.com/tag/notification

I am going to reuse all the configurations which I used in the previous article and do only a little customization for this article.

Actions already completed are

1. A notification channel – Refresh Work queue was created

Update – Add additional property – pyMessageLabel

2. A notify activity was created – RefreshAssignmentNotification

– Add an additional parameter – Message in the Parameters tab.

– Do the additional property-set in step 2 for pyMessageLabel

 3. Update the notification flow configuration to pass the Message

Save all those rules.

First, let’s catch the published message from the developer tools.

Step 1: Open the developer tools – networks tab – WS selected.

Step 2: Create a new case to send the notification.

Step 3: Click on the new message to view the JSON message structure.

Note down the message JSON structure.

Now the interesting part to read the message.

Important note: With the latest Pega versions, you can read the message only by using Javascript function!

Let’s start the implementation.

How to read published notification messages?

Step 1: Create a new JavaScript file  – HandleWebSocketFunctions

Note: You can reuse the script in any existing text file or in any non-auto generated section.

Step 2: Include a new function – handleRefreshAssignmentCallback in the text file rule.

The input for the function is data = which can be mapped to event data from the UI.

I am reading two property values – pyAssignmentOwner and pyMessageLabel and putting it into console log to unit test.

You can see how the message data gets passed to the function as parameter and parsed into individual variables.

Save the text file rule.

Step 3: Include the JavaScript file in the corresponding harness rule.

Now on loading the harness (dashboard), the JavaScript function will be registered within the browser.

Step 4: Use the callback function in the section action-set.

Update the action-set for function callback. Pass the data parameter value as event data.

Save the section.

We are done with the configurations. Let us test the changes.

Step 1: Open the developer tools – console tab.

Step 2: Create a new case and check the console logs.

You see our Pega function executed successfully, read the published message and logged the same in console

Good sign.

You are able to capture the event messages in JavaScript variables.

Next action? – You know you can do all types of processing inside a JavaScript function like creating a new case, call activity, data transform etc.

You can check the link for more details – https://collaborate.pega.com/question/how-call-data-tranform-using-javascript

https://community.pega.com/knowledgebase/articles/user-interface/rundatatransform-public-js-api-control-actions

Play whatever you want with the event data.

As a summary,

– Create a new notification channel and publish the message to client browsers

– Create a new JavaScript function to read the published message.

We are at the end of the notification series posts.

  • process
Code Vault Curators

A technical team dedicated to empowering the Pega ecosystem with in-depth knowledge, guided by Premkumar Ganesan's vision.

Post navigation

Previous
Next

Pega Courses

Pega courses can be accessed at https://myknowacademy.com

Search through the blog

Tags

activity authentication background-processing case-management data-model declarative-processing email-processing file-processing pega-core-concepts pega-integration process reporting security system-administration user-interface validation

Categories

  • Code Vault

Recent posts

  • Service REST – Usage and Configurations in Pega
  • Queue processor – Usage and Configurations
  • Data Pages Usage & Configurations in Pega
  • Requestor types in Pega
  • Case Locking Mechanism in Pega

Related Articles

Code Vault

Flow Action – Usage and Configurations in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will see about different configurations and usage of a flow action rule. What is flow action rule? Flow action rule contains all the configuration points that describe how a user interacts with an assignment using work forms. We know that every business process follows a certain flow. The flow starts […]

Code Vault

Notifications in Pega – Part 3 – Create custom notification

December 10, 2024 Code Vault Curators

In this blog article, we will see how to create a custom notification and perform UI action using WebSocket Publish-Subscribe event processing. It is recommended to go through the first two articles on the notification series before proceeding on this article. https://myknowtech.com/tag/notification Business scenario: Whenever a work is assigned to Sales workbasket, the workbasket should […]

Code Vault

Service Level Agreements in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will see in detail about Service level agreements. The main objective of Service Level Agreement is to process any time bound requirements in the Pega application. Imagine, Timesheet Pega application. Reminder email – If an employee fails to submit the timesheet by the end of the month (April 30th), then […]

Code Vault

Notifications in Pega – Part 2 – Web Gadget channel

December 10, 2024 Code Vault Curators

In this blog article, we will see how we can send out notifications from Pega. Notifications can be email, mobile push messages or an update on the notification gadget. It is mandatory to go through my previous blog articles on WebSocket introduction. In the article, I will showcase the notification update using the out-of-the-box Notification […]

About

MyKnowTech was born with a mission to bridge the gap between technical expertise and business needs. We are a boutique firm specializing in Pega solutions, delivering them with a personal touch. At the heart of our philosophy is a commitment to putting clients first.

Company
  • About
  • Leadership
  • Career
  • Contact
Resources
  • Blog
  • Services
  • Solutions
  • Insights

©  MyKnowTech B.V. All Rights Reserved.

  • Sitemap
  • Terms & Conditions
  • Privacy Policy