Catalog UI Policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
20 hours ago
I ma tryint
I am working on a ServiceNow Catalog Item where I have multiple UI Policies to show/hide variables based on a choice field called “Modification Type”.
🔹 Modification Type values:
- Item/Category Approval Matrix Modification → approval_matrix_modification
- Item Form Modification → form_modification
- Item/Category Visibility Modification → visibility_modification
🟦 Issue:
I have created Catalog UI Policies with conditions like:
- modification_type = approval_matrix_modification
- modification_type = form_modification
- modification_type = visibility_modification
Each UI Policy is configured with:
- On Load = true
- Reverse if false = true
- UI Policy Actions to show/hide variables accordingly
❗ Problem:
On form load, all variables are visible instead of being hidden.
Even after selecting a specific Modification Type, unrelated variables are still visible or not hiding properly.
🟦 What I have already tried:
- Verified UI Policy conditions
- Checked choice values (label vs value mapping)
- Set UI Policy Actions for visible/mandatory correctly
- Adjusted UI Policy order
- Ensured variables are not mandatory by default
Still, UI Policies are not behaving as expected.
🟦 Question:
What is the correct approach to ensure that:
- All variables are hidden on load by default
- Only relevant variables appear based on selected Modification Type
- UI Policies correctly evaluate choice values (label vs actual value)
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
Hi @muskaanchan
What is your requirement or expected output?
ref: https://www.youtube.com/watch?v=MdKPSlt4mK8
https://www.youtube.com/watch?v=a6ta2qBA7Go
https://www.youtube.com/watch?v=BgwB3k8qIMg
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
Hi
The requirement is to dynamically show and hide catalog variables based on the selected value of the Modification Type field.
Expected output is that only the relevant set of variables should be visible (and mandatory where required) depending on the selected modification type, and all other unrelated variables should remain hidden on the catalog item form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
I will suggest creating 1 onChange catalog client script instead of 3 catalog UI policies
Handle the onLoad and onChange in that
Easy to maintain
function onChange(control, oldValue, newValue, isLoading) {
toggleModificationTypeFields();
}
function toggleModificationTypeFields() {
var type = g_form.getValue('modification_type');
var approvalVars = [
'approval_group',
'approval_level',
'approver_user'
];
var formVars = [
'field_name',
'field_label',
'field_type'
];
var visibilityVars = [
'catalog_name',
'category_name',
'visible_to',
'hidden_from'
];
var allVars = approvalVars.concat(formVars, visibilityVars);
for (var i = 0; i < allVars.length; i++) {
g_form.setDisplay(allVars[i], false);
g_form.setMandatory(allVars[i], false);
g_form.setValue(allVars[i], '');
}
if (type == 'approval_matrix_modification') {
showFields(approvalVars);
} else if (type == 'form_modification') {
showFields(formVars);
} else if (type == 'visibility_modification') {
showFields(visibilityVars);
}
}
function showFields(fields) {
for (var i = 0; i < fields.length; i++) {
g_form.setDisplay(fields[i], true);
}
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19 hours ago
Hi,
I understand but the requirement is to do this using catalog ui policies only