How to hide choices from choice list using client script onchange
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 11:46 PM
How to hide choices from choice list using client script onchange, i want to hide few choices in subcategories when category is changed, i tried using g_form.removeOption('subcategory', '7'); but no luck, how to solve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 12:40 AM
Hi Harish,
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
alert(newValue);
if(newValue=='Application')
{
alert('inside if');
g_form.removeOption('subcategory', 'Policy');
alert('after');
}
}
Am using this script it is working fine to hide impact urgency and other fields option but not able to hide subcategories.Why? And Policy is subcategory name and value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 12:53 AM
Can you share the screen shot what exactly you want to hide? so that I can understand.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 12:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 01:02 AM
Hi Swathi,
Can you add a screenshot of the choices for Subcategory field under incident. That will confirm the value which you are using for the removeOption() method.
Regards
Ankur
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-16-2017 01:12 AM