how to identify from which order guide a catalog item is triggered?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2019 06:54 AM
Hello All,
I got a requirement to hide a variable set on a catalog item onLoad when it is triggered from a particular order guide.Though I am able to find that the the catalog item is triggered from an order guide using "g_service_catalog.isOrderGuide()" but how will I check if is triggered from a particular order guide ?Is there any way to do this? Could any anyone please guide me on this.
Thanks!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 07:32 AM
@Poojan, You can try this script, it will get you the required SYS ID of Order guide
function onLoad() {
var orderGuide = $("sysparm_guide").value;
alert(orderGuide);
if(orderGuide == 'SYS_ID_OF_Order_Guide'){
//Do your logic
g_form.setDisplay('variable_name', true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2019 10:40 PM
@Alikutty Thanks!! I am able to get the sys_id of the order guide but only from the back-office .From the portal it gives me error in the browser console saying "TypeError: $ is not a function". Will it not work from the portal? Is there a method which works from both back-office & portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2019 11:48 PM
The above code uses Jquery and it does not work in service portal. For portal, the only known working function is g_service_catalog.isOrderGuide(). This will tell you whether catalog item is part of an order guide or not but it wont give you its sys_id.
If you are really looking to get the SYS_ID of order guide in portal then i guess you will need to hard code it somewhere in a variable or script and use it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2019 08:55 AM
I've tried this logic, but I always get null for $("sysparm_guide").
Any ideas why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2020 10:16 AM