UIKit: Open work object in Full portal on Copy sharable Link

Opening the work object in UiKit application’s full portal on Copy sharable link (simple URL) is available from the Pega 8.5.1 release. This document explains the necessary steps to make the copy sharable link in full portal.

This feature is supported for SPA portals (CaseWorker portal) and it is not supported for Multidocument portals(CaseManager portal).

Step 1:

Configure copy sharable link:

https://collaborate.pega.com/discussion/theme-cosmos-open-work-object-full-portal-copy-sharable-link

Please make sure the portalName on Step2 is “pyCaseWorker” or application’s user portal.

Step2:

Open the py-enduser-utils.js or create a new js file and add the below code. Make sure this file is attached to the portal harness i.e to pyCaseWorker or application user portal harness.

pega.namespace("pega.desktop");
pega.namespace("pega.desktop.infinity"); pega.desktop.infinity.isNewTab = function() {
    if (pega.u.d.portalName.indexOf("_TabThread_") !== -1) {
        return true;
    }
    return false;
}

pega.desktop.infinity.loadNewTabWO = function() {
 
    if (typeof newTabactionName != "undefined" ) {
      if(newTabactionName === ""){
        return;
      }
        newTabIsReloaded = "true"
        if (newTabInsHandle !== "") {
            if (newTabactionName === "openWorkByHandle") {
                openWorkByHandle(newTabInsHandle, '', '', '', 'false', 'false', {
                    target: "dynamicContainer"
                });
            } else if (newTabactionName === "openWorkItem") {
                openWorkItem(newTabInsHandle, '', '', '', 'false', 'false', {
                    target: "dynamicContainer"
                });
            }else if ( newTabactionName === "openAssignment"){ openAssignment(newTabInsHandle , '', '', '', 'false', 'false', {
                    pyReloadAlways: ""
                });
            }
        }
      
       
        newTabactionName = "";
        newTabInsHandle = "";
        newTabClassName = "";
        newTabRuleName = "";
        preActivityName = "";
        preActivityParams = "";
        tabName = "";
        preDataTransform = "";
        var url = new SafeURL("pzPagesToRemove");
        url.put("PagesToRemove", "newTabTempPage");
        pega.u.d.convertToRunActivityAction(url);
        pega.u.d.asyncRequest('POST', url);
    }
};

window.addEventListener("load", function() {
      if(pega.desktop.infinity.isNewTab()){
        pega.desktop.infinity.loadNewTabWO();
      }
    });

Step 4:

Create a new non-Autogenerated section “UserWorkInc” in Data-Portal class and add the below code snippet.

<%
   ClipboardPage newTabTempPage = tools.findPage("newTabTempPage",true);
    String actionName= "";
   String insHandle = "";
   String className = "";
   String ruleName = "";
   String preActivityName = "";
   String preActivityParams = "";
   String tabName = "";
   String preDataTransform = "";
   if(newTabTempPage != null){
    actionName = newTabTempPage.getString("pyActionName");
    insHandle = newTabTempPage.getString("pzInsKey");
    className = newTabTempPage.getString("pyClassName");
    ruleName = newTabTempPage.getString("pyRuleName");
    preActivityName = newTabTempPage.getString("pyPreActivityName");
    preActivityParams = newTabTempPage.getString("pyPreActivityParams");
    tabName = newTabTempPage.getString("pyName");
    preDataTransform = newTabTempPage.getString("pyPreDataTransform");
   }

   %>

```
<script>
   var newTabactionName = "<%= actionName %>";
 var newTabInsHandle = "<%= insHandle %>";
 var encryptedNewTabUrl = '<%= pega_rules_utilities.pzEncryptURLActionString(tools, "Thread", "pyActivity=pxOpenWorkItemNewTab") %>';
 var newTabClassName = "<%= className %>";
 var newTabRuleName = "<%= ruleName %>";
 var preActivityName = "<%= preActivityName %>";
 var preActivityParams = "<%= preActivityParams %>";
 var tabName = "<%= tabName %>";
 var preDataTransform = "<%= preDataTransform %>";
 var newTabReqURI = pxReqURI;
 var newTabIsReloaded = "";
</script>
```

Step 4:

Edit the pyWorkerPortalNavigation section in UiKit and include UserWorkInc section in it.

Step 5:

Handle the cancel action of a Assignments with the default lading page. Whenever the WorkObject is loaded in the new tab or window, the default homepage will not be loaded for better user experience. So if the user clicks the cancel button, an empty page will be seen. In order to avoid that,developer can use a when condition pyIsAutoGenThread and add the showHarness action to “My Work” or “Dashboard” for the respective actions.

There were few issues observed while running the URL mapping on UIKit app post the above configuration.

Issue :

After hitting the simple URL and logging in the case was not opened rather I saw the initial page of the Case Worker Portal.

Solution :

Here are the list of steps that I executed to resolve the issue :

  • Check if pxUseDXAPI is set as true
  • Open the application definition - > Actions → View XML → Search for pxUseDXAPI
  • If the value is set as false, we need to make it true.
  • Execute the below activity by creating it in you application ruleset

  • In the pages and classes tab the “App” page is defined of class “Rule-Application
  • Post saving the activity run it a couple of times.
  • Do a log off and Log in.
  • Now check the value for pxUseDXAPI it should be set to true.

If any 403 issues encountered while Opening the WO from the simple URL

Open UserWorkForm and register the below two OOTB API’s if you face a BAC issue while opening the WO via simple url. Add the code below :

<%

pega.getUIEngine().getUIAction(“openWorkByHandle”, null).register();
pega.getUIEngine().getUIAction(“openAssignment”, null).register();

%>

Post saving this change the issues were resolved.

Hi @SakthiVickraman,

our application is in Pega Platform 8.8.3 verison(UI KIT). and followed the above mentioned steps, for us instead of opening the workitem in full portal. point (1). it just opened the workitem directly. (2). onclick of any action on the case it prompting the login screen in popup and after entering operator credentials, that assignment is opening popup.

Can you please help us here.

@SreenivasuluV16633502

Verify the application is a Single Page Application (SPA). In the UIKIT OOTB, the Case Worker portal is built as an SPA. Please confirm the application you are trying is a case worker and not a case manager.

Then in URL mapping, ensure the portal name points to the correct portal. Make sure the URL mapping is configured according to the guidelines provided in the link below.

Theme-Cosmos: Open work object in Full portal on Copy sharable Link | Support Center.

Hi @SakthiVickraman, Thankyou for the reply.

  1. we are using case worker portal

  2. portal name is correct in url mapping configuration.

hi @SakthiVickraman,

We have followed all the steps listed in your post, configured the URL Mapping rule as per the linked article. However we try to access the link on the external application, on the first attempt, we are routed to the Home Screen with a Standard thread, and on the second click of the URL, it opens the correct case. Below are the format of the URLs. What are the recommendations to open the Case on the first attempt?

Standard thread URL.jpg

Auto Thread.jpg