Pega tools for debugging Constellation applications
With changes to the application architecture and front-end technology stack, Constellation introduces a different approach to debugging Pega Platform™ applications. Rather than relying on stateful interactions and tools such as the Clipboard, developers use a combination of Pega Platform tools and standard web developer tools to investigate application behavior. Understanding the available debugging tools and when to use them is essential for effectively troubleshooting Constellation applications.
This topic examines the tools used to debug Pega Platform applications built on Constellation.
The UI Inspector
The UI Inspector is a built-in Pega Platform™ tool that enables you to select UI components on your screen to gain insight into their place in the UI hierarchy and to visualize information about Constellation UI components, including metadata, field properties, and View properties.
Run the following code in your browser's Console to start the UI Inspector:
PCore.getDebugger().toggleInspector();
The application refreshes. An icon appears on the right side of the window, as shown in the following figure:
Clicking the Open UI Inspector icon opens the UI Inspector pane on the right side of the window with a list of components. Each component has a Metadata icon that displays the component metadata. In the following figure, the metadata for the pyAddressForm View is displayed:
When you are finished working with UI Inspector, run the following code in the Console to turn off the UI Inspector functionality:
PCore.getDebugger().toggleInspector();
The Pega Clipboard
The Pega Clipboard is partially supported in Constellation applications.
The Clipboard tool is only usable to investigate static data when a Case is run in Preview mode.
It is not possible to run the Clipboard tool from the end user (React-based) Portal, or to run it from Infinity Studio and then switch to the user Portal thread to investigate live data.
Constellation applications communicate with the Infinity server via the Constellation DX API V2, which is a stateless interface. Because of Constellation's stateless nature, the Clipboard tool is released after each DX API call.
The Tracer tool
Pega's Tracer tool is supported for Constellation applications with some changes.
Because Constellation applications are stateless and rely on DX APIs, the Tracer tools' results window reflects the scheme in which your application interacts with a browser during a browser session.
The Tracer tool continues to support tracing of Service REST rules, which is particularly useful when debugging DX API calls and can also be used during a Service REST simulation.
The Tracer tool can be used to open the current Step Page for any Rule that runs during a Constellation DX API call, or to watch for a particular Page. There are some differences in the output:
- Tracer tool output is grouped by Constellation DX API call
- Each UI action generates a separate Constellation DX API call. The stateless architecture forces each request to follow the same procedure:
- Authenticate the API call
- Invoke an Automation Rule.
- Process the initial setup (ApplicationSetup, InitialProfileSetup, etc)
- Process the API request
- Return the response to the client
There is a new Tracer tool setting called View Rules. As seen in the following figure, you must open the Tracer tool's settings and select the View Rules checkbox for the Tracer to capture the relevant information:
The View Rule setting enables you to trace Views and investigate the View metadata being passed back to the client.
For greater clarity, the results window groups events by request ID, because in Constellation applications, multiple requests can be active simultaneously.
The DebugPegaAPI dynamic system setting
For more verbose debugging of API calls, set the DebugPegaAPI dynamic system setting Rule equal to true, as seen in the following figure:
This option logs additional fields in the Pega API Rest Service Info statements, helping to debug Page instructions and field-level security.
When the DebugPegaAPI rule is active, the following information is saved into the Pega log files:
- Input values used in the request body of the DX API calls
- Actions performed by the DX API
- Fields in the View where your DX API encounters errors and exceptions
- Descriptions of the cause for errors and exceptions
- Error codes and exception numbers
Inspecting View metadata
Constellation applications use a model-driven architecture in which Views are generated from the application's Data Model, Field Types, and configuration. When troubleshooting a View, it is often more useful to inspect the generated metadata than the underlying rule definition.
You can use the UI Inspector to examine the metadata associated with a View and its components at run time. Open the UI Inspector and select the View that you want to investigate. The Metadata panel displays information about the selected View, including its configuration and the properties used to render the user experience. Reviewing this metadata can help you validate View behavior, identify configuration issues, and better understand how the View is assembled at run time.
In the following example, the UI Inspector displays the metadata associated with the Pulse widget:
Check your knowledge with the following interaction:
This Topic is available in the following Module:
Want to help us improve this content?