Unable to hide Variable set variables for one catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2020 05:35 AM
Hi Experts,
I am unable to run my catalog UI policy on variables of Variable set over Catalog UI Policy on Variable Set .
I tried Catalog Client script on my catalog item to hide the variable set variables but no luck .
I am using one variable set which is being used by more than 10 catalog items . On this variable set , two catalog UI policies are running which is taking precedence over catalog item UI policy .
Please help me out to achieve this .
Thanks in Advance
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 05:38 AM
yeppie we did it .
Many Thanks Ankur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 11:27 PM
You are welcome
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
07-09-2020 10:10 PM
Hi Ankur,
I need your help again on this . I checked that script on Item it was working as i need but when i checked that on service portal its showing me Javascript error in Catalog client script code for line.
var catItemSysId = g_form.getParameter("sysparm_id");
Please suggest how to take this error out .
Many Thanks ,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2020 10:42 PM
Hi sheetal,
that's correct for service portal it won't work
possibly you should try to get the url parameter and check if that catalog item sys_id is present or not
something like this
var url = top.location.href;
var catalogItemSysId = new URLSearchParams(url).get("sys_id");
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
07-10-2020 01:39 AM
No Luck Ankur , Please check the final script i wrote :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var url = top.location.href;
var catalogItemSysId = new URLSearchParams(url).get("sys_id");
if(catalogItemSysId =='Sys ID of ITEM'){
if (g_form.getValue('var_user_type')=='New User'){
g_form.setVisible('Variable1_name',false);
g_form.setVisible('variable2_name ',false);
}
}
}