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.