- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 07:47 AM
Hello,
I have a catalog item that has two variables. I also have specific variables that depend on the selection of the two variables. I want to be able to hide all these dependent variables and their fields when the form loads until a user selects one of the first variables.
I have checked the article below but tried the options to no avail:
https://community.servicenow.com/community?id=community_article&sys_id=0bff52e91b0620901e579979b04bcb27
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 08:05 AM
I can't see any select box variable in the screenshot that you have provided, if you want to hide dependent variable based on radio buttons variable then you can use UI policy in which you can create ui policy action which either display or hide the variable based on the ui policy condition. rather then writing client script.
you can create ui policy with no condition that can hide all the dependent variable and uncheck "reverse if false" this will hide all the dependent variable on load of the form, then create another ui policy with condition in which radio button is true and add ui policy action in it which either hide or display the relevant dependent variables
UI policy doc link
https://docs.servicenow.com/en-US/bundle/sandiego-platform-administration/page/administer/form-administration/task/t_CreateAUIPolicy.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 08:02 AM
Hi,
Can you specify which variables are dependent on which variables.
Specify which all are dependent and which all are independent as well.
And Do you want all the dependent variables to be hidden at the time of form load?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 08:05 AM
I can't see any select box variable in the screenshot that you have provided, if you want to hide dependent variable based on radio buttons variable then you can use UI policy in which you can create ui policy action which either display or hide the variable based on the ui policy condition. rather then writing client script.
you can create ui policy with no condition that can hide all the dependent variable and uncheck "reverse if false" this will hide all the dependent variable on load of the form, then create another ui policy with condition in which radio button is true and add ui policy action in it which either hide or display the relevant dependent variables
UI policy doc link
https://docs.servicenow.com/en-US/bundle/sandiego-platform-administration/page/administer/form-administration/task/t_CreateAUIPolicy.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 04:17 PM
Thank you, your recommendation actually worked, I hid all variable without a condition with UI Policy then created another UI Policy to unhide the variable with a condition.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 08:06 AM
Hi Younes,
You can try with UI policy- provide conditions when the dependent variable's options will be empty. Then create a UI policy action to make that dependent variable visible false.
Please mark this answer as correct/helpful if it has added value.