Last active
March 20, 2018 01:24
-
-
Save thisnameissoclever/2c73044d99d35f47534a45fb708b0698 to your computer and use it in GitHub Desktop.
ServiceNow "Try in Portal" button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://snprotips.com/blog/2018/3/15/service-catalog-try-in-portal-button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openPortalPageList() { | |
var itemID = g_form.getUniqueValue(); | |
var gwPortals = new GlideDialogWindow('try_item_portal_page'); | |
gwPortals.setTitle('Try Portal Page (select portal)'); | |
gwPortals.setPreference('portal_page_id', 'sc_cat_item'); | |
gwPortals.setPreference('item_id', itemID); | |
gwPortals.render(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function goThere(suffix, id, item) { | |
var url = new GlideURL('/' + suffix); | |
url.addParam('id', id); | |
url.addParam('sys_id', item); | |
var w = getTopWindow(); | |
GlideDialogWindow.get().destroy(); | |
w.popupOpenFocus(url.getURL(), 'try_portal_page', 950, 700, '', false, false); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<j:set var="jvar_page_id" value="${RP.getWindowProperties().get('portal_page_id')}"/> | |
<j:set var="jvar_item_id" value="${RP.getWindowProperties().get('item_id')}"/> | |
<g:evaluate var="jvar_gr" object="true" jelly="true"> | |
// find existing portals | |
var grPortal = new GlideRecord("sp_portal"); | |
grPortal.query(); | |
grPortal; | |
</g:evaluate> | |
<j:while test="${grPortal.next()}"> | |
<div style="padding:4px;" onclick="goThere('${grPortal.url_suffix}', '${jvar_page_id}', '${jvar_item_id}')">${grPortal.title} (/${grPortal.url_suffix})</div> | |
</j:while> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment