How to launch a new portal from a existing portal on button click , as a new tab in browser
To launch a new portal from existing portal go to existing portals harness->scripts and styles->create a type js file with some name and paste code as below.
create a text file with code as below.
function SwitchNewPortal(e, f, c) { if (e !== f) { if (null == c || 0 >= c.length) c = e; var l = pega.u.d.fieldValuesList.get(c); "undefined" === typeof l && (l = c); c = pega.u.d.fieldValuesList.get("SwitchPortal") + " " + l + " " + pega.u.d.fieldValuesList.get("PortalText"); c = SafeURL_createFromURL(pega.desktop.pzProcessPortalSwitch); c.put("portal", e); c.put("Name", f); c.put("developer", !1); c.put("switchPortal", !0); pega.ui.composer && pega.ui.composer.isComposerPreviewFrame() && c.put("isPreviewFrame", !0); if (e = pega.desktop.support.getDesktopWindow()) e.logout = !0; // window.location.href = c.toURL() window.open(c.toURL(),"_blank"); } } //static-content-hash-trigger-GCC
Now add a button in portal with a button on click run script ->SwitchPortal
Add 2 params below that function as below
param1 ->under value pass portal name hardcoded (example: User)
param2->pyPortal.pyOwner
declare pyPortal in pages and classes to Data-Portal class.