Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Information on the pxThread is stale after SwitchApplication

SA-91821

Summary



On using two tabs in the same browser session to access the same Pega Platform instance and switching applications in the first tab, the second tab refreshes partially. When the user creates a work object from the second tab, the work object is created in the application that the user switched to in the first tab; however, the tab is malformed. The tab's prefix is not from either application and does not have the pxFlow entries.


Error Messages



Not Applicable


Steps to Reproduce

  1. Log in to the application with Single Sign-On (SSO).
  2. Launch a portal.
  3. Close the tab instead of logging off.
  4. Relaunch the session.
  5. Switch to a different application from the portal. Work items from the previous application display.


Root Cause



A software use or operation error.

The user attempted to access multiple applications with the same requestor in two browser tabs in the same browser session.



Resolution



Perform the following local-changes:

To prevent the use of multiple tabs or windows in the same browser session, perform the below steps:
  1. Save the HTML Fragment rule UserWorkForm to an Application ruleset.
  2. Add the below code to the HTML source. Modify the code if necessay to change the Alert message, or to implement the functionality noted in the Inline comments.

    <script>

      pega.desktop.windowReloadHandler = function() {

      var harnessContext = pega.ui.HarnessContextMgr.getCurrentHarnessContext();

      var pxClientSession = harnessContext.getProperty("pxClientSession");

      var pyRequestorToken = localStorage.getItem("pyRequestorToken" + pxClientSession);

      if (window.localStorage && pyRequestorToken && harnessContext.getProperty("pyRequestorToken") != pyRequestorToken) {

        alert("Cutomer's customized message here to the user.");

    //Comment below two lines if you want to block the user from continuing work in the same window.

    //If below lines are commented, alert is shown to the user continously and user cannot proceed further.

        pega.desktop.support.getDesktopWindow().MWReloading = 'true';

        pega.desktop.support.getDesktopWindow().location.reload();

      }

    }

    </script>

To prevent the creation of the malformed work objects, perform the below steps:

  1. Save the Code-Security.ApplicationProfileSetup activity to an Application ruleset.
  2. Add a second Java step to the activity.
  3. Add the below code to the new Java step:

    ParameterPage paramPage = tools.getParameterPage();
    String dataPageToFlush = "D_StartingFlows";
    pega.getDeclarativePageUtils().deleteDeclarativePageInstance(dataPageToFlush, paramPage);

Published April 3, 2020 - Updated December 2, 2021

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

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

Pega Community 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
Contact us