- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2020 04:22 AM
I am trying to implement a UI action (form link) that shows in the Catalog Item form that lets developers preview the item inside Service Portal with following script. However, the gel() reference doesnt seem to work. I have an Orlando developer instance where this seems to work fine. Looking for some guidance.
function previewInPortal(){
var catItem = gel("sys_uniqueValue").value;
var url = '/sp?id=sc_cat_item&sys_id='+catItem; // replace dev Id with your instance id
window.open(url,'_blank');
}
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2020 04:57 AM
All suggestions are valid. The issue was resolved after I set the "isolate scripts" to false. I had to make that attribute visible by going into configure > form layout.
Got the hint from => https://community.servicenow.com/community?id=community_question&sys_id=be150ce2db766780656a5583ca961935

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2020 04:24 AM
gel() does not work on portal end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2020 04:26 AM
Sorry, I shouldnt have tagged the portal. This shouldnt pertain to portal, instead only on the catalog item configuration area.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2020 04:27 AM
so user is clicking this button on native ui ? are you getting any error in console log ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2020 04:30 AM
Hi Ajit,
Can you check this blog it has an update set attached & that is to be committed so as to get an view of 'Try It' on Portal.
Also, in your code replace
var catItem = gel("sys_uniqueValue").value;
var url = '/sp?id=sc_cat_item&sys_id='+catItem; // replace dev Id with your instance id
window.open(url,'_blank');
with
window.open("sp?id=sc_cat_item&sys_id=" + g_form.getUniqueValue(), "_blank");