Unable to hide one field on Catalog item form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 07:05 AM
Hi All,
There is one field with multiple options , It should not visible by default when form loads, It should only visible when someone selects "yes" as an option on another field.
I have tried creating Catalog UI policy and catalog Client script but still still it is showing by default on the form.
Thank you in advance for your help!
Thank you
Deepika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2025 12:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2025 12:51 AM
Hi @deepikagang ,
If you wanted to hide the choice option then you can write a one load client script like below.
function onLoad() {
// Remove multiple choices by repeating this line for each option you want to remove
g_form.removeOption('variable_name', 'choice_value_1'); // Remove first option
g_form.removeOption('variable_name', 'choice_value_2'); // Remove second option
g_form.removeOption('variable_name', 'choice_value_3'); // Remove third option
// Continue adding lines for other choices you want to remove
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 08:07 AM
you will have to use onLoad catalog client script to remove that option
g_form.removeOption('variableName', 'choiceValue');
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
‎02-03-2025 09:00 PM
Hi @Ankur Bawiskar ,
Thank you for your response!
There are multiple choices in this field, should I mention all of them?
Thank you
Deepika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 09:14 PM
yes you can repeat that line for removing those many options
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