Discussion
Pegasystems Inc.
IN
Last activity: 19 Nov 2024 5:15 EST
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.