
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 09:42 PM
I have a variable set that I've added to my catalog item, but I only want it to be shown if a particular catalog item variable is set to no.
The variable set is called:
vs_address_details
It's sys_id is:
df104b8ec1a25250daa3b371506bdab9
The variable (that is not in the variable set) on the catalog item is a yes/no field:
u_office_pickup_yn
I have tried a catalog ui policy, but it won't work if I set it to catalog item and choose 'visible' and "Reverse if false" is set to true on each field in the variable set, or even just choose the variable set.
Also if I try it on the actual variable set, I can't choose the variable on the catalog item as a condition.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 10:18 PM
another way is to explicitly show/hide the variables within the variable set based on the other variable
remember you need to make the variables non-mandatory to hide them
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 10:12 PM
To achieve this, you need to use a Catalog Client Script instead of a Catalog UI Policy. Catalog UI Policies do not support conditions based on catalog item variables when the variable is not part of the same variable set. However, you can write a simple onChange Catalog Client Script to dynamically show or hide the fields within the variable set based on the value of your catalog item variable (u_office_pickup_yn).
Conclusion:
Catalog UI Policies will not work across different containers like Variable Sets and Catalog Item variables. Instead, you can use Catalog Client Scripts.
Use the onChange script to dynamically show or hide variables inside a variable set based on the value of a catalog item variable (u_office_pickup_yn).
Optionally, use an onLoad script to hide the fields initially when the form loads.
If you found this solution helpful, please mark it as helpful!
Let me know if you have further questions or need clarification!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 10:13 PM
To achieve this, you need to use a Catalog Client Script instead of a Catalog UI Policy. Catalog UI Policies do not support conditions based on catalog item variables when the variable is not part of the same variable set. However, you can write a simple onChange Catalog Client Script to dynamically show or hide the fields within the variable set based on the value of your catalog item variable (u_office_pickup_yn).
Conclusion:
Catalog UI Policies will not work across different containers like Variable Sets and Catalog Item variables. Instead, you can use Catalog Client Scripts.
Use the onChange script to dynamically show or hide variables inside a variable set based on the value of a catalog item variable (u_office_pickup_yn).
Optionally, use an onLoad script to hide the fields initially when the form loads.
If you found this solution helpful, please mark it as helpful!
Let me know if you have further questions or need clarification!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 10:16 PM
To achieve this, you need to use a Catalog Client Script instead of a Catalog UI Policy. Catalog UI Policies do not support conditions based on catalog item variables when the variable is not part of the same variable set. However, you can write a simple onChange Catalog Client Script to dynamically show or hide the fields within the variable set based on the value of your catalog item variable (u_office_pickup_yn).
Conclusion:
Catalog UI Policies will not work across different containers like Variable Sets and Catalog Item variables. Instead, you can use Catalog Client Scripts.
Use the onChange script to dynamically show or hide variables inside a variable set based on the value of a catalog item variable (u_office_pickup_yn).
Optionally, use an onLoad script to hide the fields initially when the form loads.
If you found this solution helpful, please mark it as helpful!
Let me know if you have further questions or need clarification!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 04:40 PM - edited 04-14-2025 04:44 PM
You do not need to go to the effort to specifically hide all the fields in the Catalog Client Script, all you need to do is make sure that you have an onLoad Catalog Client Script that hides the actual variable set and makes the fields not mandatory, after that your normal Catalog UI Policy will work.
EG:
onLoad Catalog Client Script (Make sure that UI type is set to all)
function onLoad() {
//Set all fields within the variable set to non mandatory
g_form.setMandatory('u_address', false);
g_form.setMandatory('u_town_city', false);
g_form.setMandatory('u_state', false);
g_form.setMandatory('u_zipcode', false);
//Make the variableset not visible - no need to do this for each variable, just the name of the variable set.
g_form.setDisplay('vs_address_details', false);
}
Do a regular Catalog UI Policy with "Reverse if false" selected, set the variables in your variable set the way you want them, including setting them to mandatory when the condition is met. That way they will show and hide as they would with a normal Catalog UI Policy, without affecting the Variable Set on other items it is being used on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 10:18 PM
another way is to explicitly show/hide the variables within the variable set based on the other variable
remember you need to make the variables non-mandatory to hide them
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader