How to hide all variables from catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 05:14 AM
Hi,
How to hide all variables from catalog item.
I am trying it with UI policy but I have 15 Ui policies on same catalog item and also I have given order to all UI policies.
but it is get override on other UI policy.I have written this script but it is not working properly
var dbtype = g_form.getValue('Department');
var subType = g_form.getValue('subDepartment');
if (dbtype == '' && subType == '') {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setMandatory(fields[x], false);
g_form.setDisplay(fields[x], false);
}
this not working properly when I change the dbtype and subType values.I written script in else if condition as well.
or I need to write as below for all variables because it is working
g_form.setMandatory('monthlySchedule', false);
g_form.setDisplay('monthlySchedule', false);
}
For multiple choice variable type above APIs not working
multiple choice variable : Department
Mandatory : true
g_form.setMandatory('department', false);
g_form.setDisplay('department', false);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 05:23 AM
Hi there,
Is this for Catalog Item on Service Portal or on Platform UI?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 05:32 AM
this is for catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 05:25 AM
Hii,
You can use variable set for your variables.
Then you can hide the variable set using
g_form.setDisplay('variable_set_name',false);
in the catalog client script
Don't Forget to tick the applies to requested items.
Kindly Mark it as correct and helpful if applicable
Thanks and regards,
Priyanka Patil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 05:35 AM
Hi,
You can use variable set for your variables.
Then you can hide the variable set using g_form.setDisplay('variable_set_name',false); in the catalog client script
Don't Forget to tick the applies to requested items.
please mark my comment correct and helpful.
Thanks
Tanushree
Thanks,