Close Menu
MyKnowTech
    MyKnowTech
    • Technical Blogs
    • Career
    • Partner Spotlight
    • Videos
    • Pega News
    • Services
    LinkedIn YouTube Facebook
    MyKnowTech
    Code Vault

    Notifications in Pega – Part 4 – Read published message

    Editorial TeamBy Editorial TeamDecember 10, 2024Updated:May 31, 2026No Comments3 Mins Read
    Share LinkedIn Telegram Email WhatsApp Copy Link

    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
    Editorial Team

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

    Related Posts

    Code Vault

    Flow Action – Usage and Configurations in Pega

    December 10, 2024
    Code Vault

    Notifications in Pega – Part 3 – Create custom notification

    December 10, 2024
    Code Vault

    Service Level Agreements in Pega

    December 10, 2024
    Code Vault

    Notifications in Pega – Part 2 – Web Gadget channel

    December 10, 2024
    Code Vault

    Notifications in Pega – Part 1 – WebSocket introduction

    December 10, 2024
    Code Vault

    Tickets Usage and Configurations in Pega

    December 10, 2024
    Search through the blog
    Tags
    activity Advanced authentication background-processing Beginner case-management Constellation data-model declarative-processing email-processing file-processing Integration pega-core-concepts pega-integration process reporting security system-administration user-interface validation
    Pega Courses

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

    About

    MyKnowTech is a boutique Pega enablement and consulting firm – helping organizations build internal Pega capability through structured training programs, Centre of Excellence setup and hands-on architecture guidance.

    Company
    • About
    • Leadership
    • Career
    • Contact
    Resources
    • Technical Blogs
    • Career
    • Partner Spotlight
    • Videos
    • Pega News
    • Services

    ©  MyKnowTech B.V. All Rights Reserved.

    • Sitemap
    • Terms & Conditions
    • Privacy Policy