Sunday, November 2, 2025

Routing table

 Understanding the Routing Table in Pega Constellation 🚦

Pega Constellation is built on a cutting-edge, React-based UI architecture where everything is metadata-driven. Unlike traditional Pega UI, which handled layouts and navigation through sections and harnesses, Constellation uses a routing table to seamlessly translate user actions and URLs into the right view handlers—and ultimately, the correct React screen.

Think of the routing table as your Google Map App: Every click or navigation request takes the “destination” (user action) and maps it to the right “path” (route configuration), ensuring users always land on the right screen.

How does it work?

  • When you click a button or open a page, Constellation consults the routing table to figure out.
  • This process leads to a consistent, high-performance, and maintainable user experience across web, mobile, and embedded SDK apps.

Why does this matter?

  • Consistency: Same URL behaves the same on all platforms.
  • Performance: The app always knows exactly which handler and API to use, reducing overhead.
  • Maintainability: Centralized routing logic means upgrades and new features are easier and safer to implement.

Routing flow in a Constellation: User Click → Navigation Manager → Routing Table → View Handler → DX API → React View

Whether you’re opening a case or navigating between screens, the routing table ensures the right handler calls the right API to fetch the right data—instantly updating the UI through React, with no full-page refresh.

Here is a clear, step-by-step explanation of the routing flow in Pega Constellation, suitable for sharing as content:


Routing Flow in Pega Constellation : Step-by-Step

Step 1: User Click When a user clicks a button, link, or opens a URL (e.g., /cases/12345/assignment), the browser doesn’t directly know which data or view to load. For example, clicking "Open Case" triggers a navigation request handled by the Constellation shell.

Step 2: Routing Table This is where the mapping starts. The routing table matches the navigation request to the right route definition by:

  • Checking the URL pattern (like /cases/:caseID).
  • Determining which view type to load — Case View, Assignment View, or Landing Page.
  • Identifying the correct view handler that will fetch needed data and metadata. So, your click translates to: “User wants to open a case → use Case View Handler → fetch data via /cases/{ID} endpoint.”

Step 3: DX API Call Once the view handler is identified, it calls the DX API (Digital Experience API) to retrieve everything needed for rendering. The API returns:

  • View metadata defining layout, fields, and components.
  • Data payload with the actual case or assignment information. This is lightweight JSON, not HTML.

Step 4: React View Rendering The React engine uses the metadata and data to dynamically build the UI through the PConnect framework.

  • The screen loads instantly without full-page refresh.
  • Navigating to another case reuses the layout, changing only the content.

Step 5: User Sees Updated Screen The user instantly sees the correct screen. Copying and reopening the URL later triggers the same routing logic to render the updated view with the latest data.

In short: The routing table is the backbone of navigation in Pega Constellation—enabling smooth, dynamic, and maintainable UI experiences for all users.

Thursday, August 7, 2025

Document generation

 https://docs.pega.com/bundle/example-word-template/resource/example-word-template.pdf

https://www.techpapers.online/post/ms-word-document-generation-from-pega


The issue was that HTMLToPDF accepts isClearCache as a parameter. By default it's set to false. If I set it to true it clears cache and loads css each time, otherwise it refers to the cache and does not refer to the updated CSS.

Saturday, March 22, 2025

Pega Service, Connecor

When the session state in a service package is set to Stateful, the service returns a cookie in the response with the Set-Cookie HTTP header. The cookie contains the Requestor ID of the requestor that processed the first request, with the prefix "PegaRULES." For another request to access the same session data, the external application must include the PegaRULES cookie in the header of that request. 


Subsequent request

It works even if the UserIdentifier and Passwrod not passed to the API. It works by the sticky session





REST-Service

  1. Map from Clipboard doesn't accept PageList.
  2. Map from Clipboard, Key as Page or Property will make the response type as XML.
  3. Map from Clibpard, Key can be Parameter page.
  4. Map from JSON accept Page, PageList

Connect-REST

  1. Map from Clipboard Page expects XMLstream data.
  2. Map from JSON expect json stream data

If the content-type header of the REST response returned from the REST endpoint indicates that the response message body does not contain text, the system handles the message as an array of bytes rather than as an array of characters. To map an array of bytes, complete the following steps:
  1. In the Message data section, in the Map to field, select Clipboard.
  2. In the Map to key field, enter one of the following values:
  • Text property: The system converts the text property to Base64-encoded text before writing it to the clipboard.
  • Java object property: The system converts the java object property to a java byte array before writing it to the clipboard.


Friday, January 24, 2025

Create case

 import javax.net.ssl.*;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.ProtocolException;
import java.net.MalformedURLException;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;


public class Main {
    static String createCase() throws IOException, NoSuchAlgorithmException, KeyManagementException {
        String caseId=null;

        String messageContent = "";
        BufferedReader br = new BufferedReader(new FileReader(new File("CreateCase.json")));
        String line=null;
        while((line=br.readLine())!= null){
            messageContent += line;
        }
        // Printing the message
        System.out.println(messageContent);
        // URL of the API or Server
        String url = "<<URL>>";
        URL urlObj = new URL(url);

        TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                return null;
            }
            public void checkClientTrusted(X509Certificate[] certs, String authType) {
            }
            public void checkServerTrusted(X509Certificate[] certs, String authType) {
            }
        }
        };

        // Install the all-trusting trust manager
        SSLContext sc = SSLContext.getInstance("SSL");
        sc.init(null, trustAllCerts, new java.security.SecureRandom());
        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());

        // Create all-trusting host name verifier
        HostnameVerifier allHostsValid = new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;
            }
        };

        // Install the all-trusting host verifier
        HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);

        HttpsURLConnection postCon = (HttpsURLConnection) urlObj.openConnection();
        //postCon.setSSLSocketFactory(SSLCertificateSocketFactory.getInsecure(0, null));
        //postCon.setHostnameVerifier(getHostnameVerifier());
        postCon.setRequestMethod("POST");

        // Setting the message content type as JSON
        postCon.setRequestProperty("Content-Type", "application/json");
        postCon.setDoOutput(true);
        // for writing the message content to the server
        OutputStream osObj = postCon.getOutputStream();
        osObj.write(messageContent.getBytes());
        // closing the output stream
        osObj.flush();
        osObj.close();
        int respCode = postCon.getResponseCode();
        System.out.println("Response from the server is: \n");
        System.out.println("The POST Request Response Code :  " + respCode);
        System.out.println("The POST Request Response Message : " + postCon.getResponseMessage());
        if (respCode == HttpURLConnection.HTTP_CREATED)
        {
        // reaching here means the connection has been established
        // By default, InputStream is attached to a keyboard.
        // Therefore, we have to direct the InputStream explicitly
        // towards the response of the server
            InputStreamReader irObj = new InputStreamReader(postCon.getInputStream());
            br = new BufferedReader(irObj);
            String input = null;
            StringBuffer sb = new StringBuffer();
            while ((input = br .readLine()) != null)
            {
                sb.append(input);
            }
            br.close();
            postCon.disconnect();
            // printing the response
            String strResponse=sb.toString();
            caseId=strResponse.substring(strResponse.indexOf(" ")+1,strResponse.indexOf("\","));
        }
        else
        {
            // connection was not successful
            System.out.println("POST Request did not work.");
        }
        return caseId;
    }

    private static HostnameVerifier getHostnameVerifier() {
        HostnameVerifier hostnameVerifier = new HostnameVerifier() {
            @Override
            public boolean verify(String hostname, SSLSession session) {
                HostnameVerifier hv =
                        HttpsURLConnection.getDefaultHostnameVerifier();
                return hv.verify("com.example.com", session);
            }
        };
        return hostnameVerifier;
    }

    public static void main(String[] args) throws IOException, NoSuchAlgorithmException, KeyManagementException {
        String caseId = createCase();
        System.out.println("CaseId="+caseId);
    }

}







################CreateCase.json################
{
  "caseTypeID": "ING-WB-PAM-Work-BillableAgreement",
  "content": {
    "Country":"CzechRepublic",
    "AccountDetails":{
      "AccountBIC":"INGBCZPPXXX",
      "AccountName":"NABUURS S.R.O.",
      "AccountNumber":"",
      "AccountStartDate":"20170424",
      "AccountStatus":"O",
      "AccountType":"CACC",
      "BankCode":"3500",
      "Currency":"CZK",
      "StartDate":"20170424T000000.000 GMT",
      "SubAccountType":""
    },
    "AccountIdentifiers":{
      "BBAN":"CZ1535000000001000427519",
      "Currency":"CZK",
      "IBAN":"CZ1535000000001000427519"
    },
    "GridDetails":{
      "GRIDID":"479527870",
      "IBSSRNr":"",
      "pyID":"47952787"
    }
  }
}