Skip to main content

Developer tools for examining applications

Pega Platform™ offers robust tools for developing and managing applications, including powerful debugging features to help your applications run smoothly. Debugging View Rules in the Pega Platform is a crucial aspect of maintaining and troubleshooting the UI of your application.


Accessing View Rule metadata in Dev Studio

To explore the metadata of a View Rule, you can use the either the Search bar or the App Explorer, both of which are located in Dev Studio. By searching for ViewName pxObjClass: Rule-UI-View in the Search bar or navigating through the App Explorer to find Rule-UI-View, you can access a list of available Views in your application, as shown in the following figure:

The list of available Views using Rule-UI-View in the App explorer.

When you open a View rule in Dev Studio, the result displays the metadata associated with the individual View. To inspect the JSON associated with a View, ensure that the pxEnableC11nDev When Rule is set to true.

The following figure shows the JSON data associated with the ResolutionMethod View:

ResolutionMethod View metadata.

Core browser developer tools

Contemporary web browsers contain a suite of utilities known as developer tools, which facilitate the debugging process for applications running on the page. Through these tools, users can scrutinize the assets requested by the page and monitor their loading times accurately. The availability and features of developer tools vary depending on the browser of the application.

Nota:  For more information about the list of browsers that Pega Platform supports, see Pega Platform Client Operating System and Browser Support.

Modern web browsers include integrated tools tailored for inspecting and debugging front-end applications. In Chrome, Firefox, and Edge, you can access these developer tools by pressing the F12 key on your keyboard.

Within the developer tools, several key areas warrant attention:

  • Console tab: Reveals the active scripts that are running on the web page.
  • Network tab: Displays DX API calls with the option to filter by Fetch/XHR. Both request and response payloads are visible here.
  • Application tab: Enables inspection of cached items in Local and Session storage

The following figure shows the location of these tabs in the Chrome browser DevTool menu:

Main menu of Chrome browser DevTools.

React and Redux DevTools

React DevTools, a complimentary plugin, empowers you to examine React component hierarchies in the browser's developer tools. You can use the React DevTools browser extension to view application metadata at run time. When enabled, this extension adds a Components tab to the console. You can select any element to highlight the screen and then enter the  $r.props.getPConnect() command to view the component metadata.

The following figure shows an example of the Components output in Google Chrome:

React dev tools components.

Redux DevTools is a free browser plugin that helps you visualize and track state changes in your application. After you enable it, the extension adds a Redux tab in the developer tools, which logs every action dispatched in the application. This log shows the type and payload of each action, helping you understand how the state evolves. You can inspect each state and action payload directly in the browser's developer tools. You can also inspect the state tree at any point, which makes debugging easier when the state does not update as expected. With the tool's time-traveling feature, you can step through state changes and pinpoint issues related to incorrect updates.

The following figure shows an example of Redux logs with event type along with payload:

Redux dev tool logs with event and payload information.
Nota: For more information about the browser developer tools, see Debugging tools.

Xray tool

The XRay tool provides an intuitive way to debug screen issues, such as metadata, field metadata, and state properties overlayed in the UI. You activate the XRay tool, by entering PCore.getDebugger().toggleXRay(true) in your browser's console. Entering PCore.getDebugger().toggleXRay(false) deactivates the XRay tool.

As you interact with the application in your browser window, you might notice changes in its appearance. You can explore different elements and inspect the metadata associated with each one. In the following figure, the metadata for the HandleTicket View is displayed:

The metadata associated with the HandleTicket View using PCore.getDebugger()toggleXray(true);.
Nota: Access to the PCore and PConnect APIs is unavailable in the App Studio shell. For optimal use of methods associated with PCore and PConnect, launch the Portal from Dev Studio. For more information, see Working with ConstellationJS APIs.  

The DebugPegaAPI dynamic system setting

Setting the DebugPegaAPI dynamic system setting Rule equal to to true, as shown in the following figure, helps you perform a more verbose debugging of API calls:

The DebugPegaAPI rule set equal to true.

This option logs additional fields in the Pega API Rest Service Info statements so that you can 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.

Debugging of client-side Data Pages

Data Pages cached on the client side are not stored within Redux but rather in the application's datastore. To log information about client-side cached Data Pages, you can run the following code in your browser's console: PCore.getDataPageUtils();.

The result is a list of the cached Data Pages that are located in the datastore of the application, as shown in the following figure:

The list of cached Data Pages in the datastore.
Nota: For more information about Data Pages, see Data Pages in Constellation

 

UI Inspector

Explore the structure of your application's UI by using 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 about their place in the UI hierarchy.

The UI Inspector lets you visualize information about the Constellation UI components, including metadata, field properties, and View properties.

In the  following image the UI Inspector shows the Metadata associated with a pyAddressForm:
 

A View's metadata in the UI Inspector pane
Nota: To learn more about the structure of your application's UI by using the UI Inspector, see Checking your application with UI Inspector.

Check your knowledge with the following interaction:


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Este conteúdo foi útil?

Quer nos ajudar a melhorar esse conteúdo?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice