- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2021 03:29 AM
I wanted to get the sys id of the order guide using client catalog script. I have created one maintain item and added one variable of type list collector. I have added this into order guide. Same maintain item will be used in multiple order guides. I need to show or hide the option based on order guide. I have created client catalog script for this maintain item and included following snippet, but this is always giving sys id of the maintain item not the order guide's.
var currentItem = g_form.getUniqueValue();
How to get order guide sys id in service portal?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2021 04:17 AM
Hi,
nope.
for both native and portal you can get the URL parameter value in the onLoad client script and get the order guide sys_id
For native URL looks like this - https://instanceName.service-now.com/com.glideapp.servicecatalog_cat_item_guide_view.do?v=1&sysparm_initial=true&sysparm_guide=6690750f4f7b4200086eeed18110c761
For portal URL looks like this - https://instanceName.service-now.com/sp?id=sc_cat_item_guide&sys_id=6690750f4f7b4200086eeed18110c761
For native - get sysparm_guide
For portal - get sys_id
function onLoad() {
//Type appropriate comment here, and begin script below
var url = top.location.href;
var orderGuideSysId;
if(window == null){
// for portal
orderGuideSysId = new URLSearchParams(url).get("sys_id");
}
else{
// for native
orderGuideSysId = new URLSearchParams(url).get("sysparm_guide");
}
alert(orderGuideSysId);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2021 03:45 AM
Hi Mihir, Try this
var orderGuide = $("sysparm_guide").value;
if(orderGuide == 'SYS_ID_OF_Order_Guide'){
//Do your logic
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2021 03:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2021 04:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2021 04:09 AM
I made that to false. But this will work in service portal also?