Supported way to run application-level JavaScript in a Constellation portal

We are using Pega Platform 25.1 with the standard Pega-hosted Constellation portal and need to integrate with a JavaScript SDK provided by a local desktop service.

The requirement is to:

  • Initialize the SDK when the portal loads.
  • Subscribe to external user/context-change events.
  • Keep the subscription active across navigation, regardless of which case, assignment, or landing page is open.
  • Eventually terminate the Pega session and redirect to SSO when the external identity context changes.

I have implemented this successfully in a custom DX widget, but that ties the integration to the component lifecycle. It must work even if the user never visits a page containing the widget, so a view-mounted component does not seem like the right extension point.

I also found this forum reply about including onload JavaScript in a Constellation portal. I tested adding JavaScript through the pyPortalIcon HTML fragment, inside its Constellation-specific branch, and confirmed that it executes without the widget being mounted.

However, this feels like a hack rather than an officially supported application-initialization mechanism: the fragment is intended for favicon customization. I have not found documentation confirming that using it to bootstrap arbitrary JavaScript is supported or upgrade-safe.

Is there a documented, Pega-approved way to load and initialize application-level JavaScript in the standard Constellation portal?

Specifically:

  • Is there a supported portal-startup hook or custom JavaScript resource configuration?
  • How should initialization wait for the Constellation runtime to be ready when public APIs are needed?
  • Can Pega confirm whether using pyPortalIcon for this purpose is supported? If not, what is the recommended alternative?

In Pega Platform 25.1, there is no clearly documented, supported global JavaScript startup hook for the standard Pega-hosted Constellation portal. The recommended solution for this requirement is to use a custom-hosted portal built with the Pega Constellation React SDK. Initialize your external JavaScript SDK once in the portal’s root component. Wait until the Constellation runtime is initialized before accessing public PCore APIs. Register the external user/context-change event listener at the application level. This keeps the subscription active when users navigate between cases, assignments, and landing pages. When the external identity changes, terminate the Pega session through the configured logout flow and redirect the user to SSO. Avoid using pyPortalIcon for application initialization because its JavaScript injection behavior is not guaranteed to be upgrade-safe

I would have to agree with @Sairohith SDK would be the way to go.

There are a few ways out there of pushing the boundaries inside OOTB but these are customisations, so caution would be advised:

I’ll ask around and see what else I can get for you @mrwolf2

the requirement that you are listing are similar to the approach I documented here Unlocking User Insights: How to configure Analytics in your Constellation Application - pyPortalIcon is a fragment that is loaded in the portal head - same approach is available in Traditional UI - DX Component should really be used when rendering UI on the screen - if this is about sending events to an external system, the pyPortalIcon is preferred (lightweight - no React deps)