Discussion
Bosch
IN
Last activity: 28 Aug 2024 21:33 EDT
Theme-Cosmos: Open work object in Full portal on Copy sharable Link
Opening the work object in theme cosmos 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.
- Configuring the simple URL.
- Configuring the supportive activity.
- Overriding the pyIsAutoGenThread when rule.
- Configuring the Copy sharable link action.
1.Configuring the Simple URL :
- It is mandatory to configure the simple URL so that the URL looks like simple path.
- Configure URL Mappings
- Save as the pyDefault in application ruleset if needed.
- URL Mappings will be available in Dev Studio - > Records -> Technical -> URL Mappings
- Add the URL alias
- Click Next
2.Configuring the supportive activity:
- Create the new activity OpenItem(Can be any name, make sure the same is reflected in the URL Mapping) in an application ruleset and Work- class
Parameters :
Name |
Data type |
Required |
WorkID |
String |
No |
WorkPool |
String |
No |
Pages and Classes :
Page Name |
Class |
pxThread |
Code-Pega-Thread |
newTabTempPage |
Work- |
Steps :
- Property set :
- Property set :
- Call pxOpenWorkItemNewTab
- Security Configurations
Provide the correct Privilege name
3.Overriding the pyIsAutoGenThread
- This is an important step to make the copy sharable link to open in portal and works correctly. Override the pyIsAutoGenThread in an application ruleset and class should be @baseclass always.
Condition :
pxThread.pxThreadName contains (ignore case) "autothread"
4.Configuring Copy sharable link :
- Copy sharable link is an action configurable on any work object. Create an action in the respective navigation pyWorkCommonActions
Configure the actions for the copy sharable link :
- Run Script
- This run script will copy the simple url to the clipboard
- Function Name :
- CopyContentToClipboard
- Parameters :
- SimpleURLValue : D_pzSimpleURL.pyURL
Add this code snippet if the function is not available in the build on app
/* The below function is for copying parameter value to systems clipboard */ function CopyContentToClipboard(SimpleURLValue) { /*Replacing spaces in url to avoid breaking of URL links*/ if(SimpleURLValue.indexOf(" ")!=-1){ SimpleURLValue=SimpleURLValue.replace(/ /g,"%20"); } var textArea = document.createElement("textarea"); textArea.style.background = 'transparent'; textArea.value = SimpleURLValue; textArea.textContent = SimpleURLValue; document.body.appendChild(textArea); textArea.select(); try { document.execCommand('copy'); } catch (err) { } document.body.removeChild(textArea); }
- Local action
- This is used to show the overlay that the url is copied to clipboard
- Refer the pySharableLinkCopied from Pega-Social ruleset and make the same changes in the respective ruleset.
Once the URL is copied to clipboard open the new browser tab and paste the copied link to open the work object in full portal.
-
Reply
-
Ravi Kumar Pisupati Sudit Sengupta Marc Cheong -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
@krism2I faced an issue when I followed the implementation guide especially for the when rule @baseclass.pyIsAutoGenThread (step 3). The defined condition didn't work well. If condition
- @String.contains(@toUpperCase(pxThread.pxThreadName),@toUpperCase("autothread"))
is used instead, it work as expected:
- user is logged in and has permissions - the system opens an independent new tab with the instance behind the link
- user is not logged in and has permissions - the system opens an independent new tab with the login screen, after login the instance behind the link opens in this tab
- user doesn't have permissions - (after login) the system presents an appropriate message that access is denied
Apart from this, just as an information, the URLMapping rule has some limitations when it comes to the usage of this configuration in an implementation layer.
@krism2I faced an issue when I followed the implementation guide especially for the when rule @baseclass.pyIsAutoGenThread (step 3). The defined condition didn't work well. If condition
- @String.contains(@toUpperCase(pxThread.pxThreadName),@toUpperCase("autothread"))
is used instead, it work as expected:
- user is logged in and has permissions - the system opens an independent new tab with the instance behind the link
- user is not logged in and has permissions - the system opens an independent new tab with the login screen, after login the instance behind the link opens in this tab
- user doesn't have permissions - (after login) the system presents an appropriate message that access is denied
Apart from this, just as an information, the URLMapping rule has some limitations when it comes to the usage of this configuration in an implementation layer.
- 1st configuration dialog - Because of the auto-completes, they don't accept DCR (e.g. =D_crmAppExtPage.WorkClass_<case type>), (leaf) classes where the mapping will be enabled need to be selected manually (Though the auto-completes show only those classes)
- 2nd configuration dialog - the same for the WorkPool definition - any value will be recognized as a class name, not as a property reference
To have this more flexible and inherit into the implementation layer without additional modifications (which require dev access), the URLMapping rule should support DCR/Global Resource Naming (GRN).
Pegasystems Inc.
AU
@krism2 Thank you for publishing this. First three steps verified to work on 8.7 ! (We didn't need the copy shareable link part)
Can you please elaborate on the significance of the pyIsAutoGenThread WHEN rule, and what other use cases may be impacted by altering its implementation?
Updated: 4 Oct 2022 8:45 EDT
Pegasystems Inc.
US
If you want to create a new case type instead of opening a case, you can follow the same process
1/ Create a new URL Mapping rule for create - call a new activity createNewWork
2/ Create a new activity CreateNewWork that takes className as parameter
3/ set the when rule pyIsAutoGenThread as indicated in the main doc
4/ Override UserHeader in your layer and add a new section UserHeaderOverride
If you want to create a new case type instead of opening a case, you can follow the same process
1/ Create a new URL Mapping rule for create - call a new activity createNewWork
2/ Create a new activity CreateNewWork that takes className as parameter
3/ set the when rule pyIsAutoGenThread as indicated in the main doc
4/ Override UserHeader in your layer and add a new section UserHeaderOverride
4/ Implement UserHeaderOverride as a non auto Section with the following content
this section will override the OOB function loadNewTabWO and add support for the new action name called createnewWork
<script>
pega.desktop.infinity.loadNewTabWO = function() {
if (typeof newTabactionName != "undefined" ) {
if(newTabactionName === ""){
return;
}
newTabIsReloaded = "true";
if (newTabactionName === "createNewWork") {
pega.desktop.createNewWork(newTabClassName,"", "pyStartCase","", "", "", false);
}
if (newTabInsHandle !== "") {
if (newTabactionName === "openWorkByHandle") {
openWorkByHandle(newTabInsHandle, '', '', '', 'false', 'false', {
target: "dynamicContainer"
});
} else if (newTabactionName === "openWorkItem") {
openWorkItem(newTabInsHandle, '', '', '', 'false', 'false', {
target: "dynamicContainer"
});
}
}
if (newTabactionName === "showHarness" && typeof newTabClassName != "undefined" && typeof newTabRuleName != "undefined") {
let replaceCurrent = false;
tabName = typeof tabName != "undefined" ? tabName : "";
preActivityName = typeof preActivityName != "undefined" ? preActivityName : "";
preActivityParams = typeof preActivityParams != "undefined" ? preActivityParams : "";
preDataTransform = typeof preDataTransform != "undefined" ? preDataTransform : "";
if (newTabRuleName === "SearchResultsPage") {
tabName = "searchResults";
replaceCurrent = true;
}
pega.d.showHarness(tabName, newTabClassName, newTabRuleName,
preActivityName, preActivityParams, "", false, preDataTransform, replaceCurrent, true, "");
}
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);
}
pega.desktop.infinity.hideBusyIndicator();
};
</script>
OCBC BANK
SG
@RichardMarsot can you help tell the steps to open an assignment and harness with full portal i tried by changing the action name to openAssignment but still i was unable to see the case details opened
Pegasystems Inc.
NL
@krism2 Thanks for the explanation but I am bit confused about If I can (somehow) use URL mappings for my business case or not.. or even necessary to use.. We are providing a service which is supposed to return direct access case links to the requestor in our response payload. We have the pyIds or pzInskKeys in hand.. What I am wondering is that If there is a way call this URL mapping rule and give me back a link that I can use ... Or any other way to build up a direct access link of the case ?
Pegasystems Inc.
NL
@topraactually yes, we can and it works:) It even supports cases from different applications / workpools.. and even one of them is enough ..
basically, whatever you configure at URL mapping comes after the host name of the machine (which ideally can be retrieved from application settings) and the activity you put does the job.
So the link can be used something like
https://YourHostAddress/prweb/Cases/{param1}/{param2} It is all crystal clear now :)
Updated: 18 Oct 2023 22:22 EDT
Pegasystems Inc.
JP
(Env: Pega Platform 8.7.3)
I faced an issue that if the user has not logged in the pega platform yet, when click the url , Pega log in page will be show up, and enter operator id / pwd to login, but after login , instead of case review page only shows user portal page. If the user already logged in the platform, then this issue does not happen, it shows case review page correctly after click the url.
To resolve this issue, it seems like we need to add a parameter to above activity step.2 , set Param.pxUseDXapi to true. Or, we need to ensure in the application setting, Advanced>> UI Runtime >> React-Based UI is selected. or (server-rendred UI >> enable reacted-based landing page )
Pegasystems Inc.
AU
@liang Modern enterprise applications using Pega would use Single Sign On (SSO) for authentication which - if not already authenticated - triggers the required authentication flow.
Once SSO authentication is complete, the original request (to the shareable link) would typically be replayed back to the Pega application, and newly authenticated users will get the same result as users who were already signed in.
Pegasystems Inc.
AU
The URL copied to the clipboard in the Javascript code at the end is the value of D_pzSimpleURL.pyURL with spaces substituted with a %20 sequence.
You could implement a calculated case property or a Data Page that does something similar so that it becomes simple to reference in a Correspondence rule.
Pegasystems Inc.
US
Note:
We have seen scenarios, where users uses URL Mapping to open/create workobject by directly activities New/Open Workobject. This is incorrect, as it does not load/paint the UserPortal. So, please note that while doing URL Mapping, it is important that we paint the UserPortal and then perform any operation. It will make sure that all the required resources(such as Harness, CSS, styles etc.) get loaded properly.
Regards, Rachit
Pegasystems Inc.
US
Also, The URL formed should be formed using the URL from Application URL alias under Application definition, which would consist of the Appname,
Calling the URL directly without the app-name would produce incorrect results.
Eg:
https://URL:8443/prweb/URLMappingIdentifier - > This is incorrect.
https://URL:8443/prweb/app/app-name/URLMappingIdentifier - > This is correct.
Hope this helps.
Pegasystems Inc.
AU
Properties on pxThread and pxRequestor are available that make the application alias of the requestor who is constructing the URL available. This is so that - where appropriate - this part of the URL can be dynamically built instead of hard-coded.