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-06-2020 09:05 PM
Hi Ankur,
Thanks for your prompt response . Yes I need the same for now i am trying for only one catalog item.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 11:08 PM
Hi Sheetal,
if you are currently looking for single catalog item then do this
1) Applies to - variable set
2) Type - onchange
3) Variable set - give your variable set name here
4) variable - var_user_type
5) UI Type - ALL
6) Script:
Note: Ensure you give your catalog item sys_id in the script below so that it runs only 1 catalog item now
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var catItemSysId = g_form.getParameter("sysparm_id");
if(catItemSysId == 'yourCatalogItemSysIdHere'){
if (g_form.getValue('var_user_type')=='Guest'){
g_form.setVisible('variable_name_1',false);
g_form.setVisible('variable_name_2',false);
}
}
//Type appropriate comment here, and begin script below
}
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-07-2020 03:20 AM
Hi Ankur,
Thanks again . I tried this but its not working for me .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 03:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2020 03:27 AM
Hi Sheetal,
Just to make sure it works just disable any other Catalog UI Policy or catalog client script on that variable set
what happens when the value is changed? did you try adding alert and check?
Note: Also check correct catalog item sys_id and valid value of var_user_type, valid variables to hide
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var catItemSysId = g_form.getParameter("sysparm_id");
if(catItemSysId == 'yourCatalogItemSysIdHere'){
alert('Inside my catalog item sys id');
if (g_form.getValue('var_user_type')=='Guest'){
alert('Inside hiding the variables');
g_form.setVisible('variable_name_1',false);
g_form.setVisible('variable_name_2',false);
}
}
//Type appropriate comment here, and begin script below
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader