Remove option and add option is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 11:10 AM
Hi all,
The requirement here is to remove option L2 support subcategory when the category is Process Knowledge/System Questions and country is other than Korea , Vietnam , Japan, Thailand. I have written an on change catalog client script which works on change of category . But add option and remove option lines are not working though it is going inside the loop. Please help me out in this. Below is the script for the same.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var country_name = g_form.getValue('u_country');
g_form.addInfoMessage(country_name);
g_form.clearOptions('subcategory');
if (country_name != 'KR' && country_name != 'VN' && country_name != 'TH' && country_name != 'JP') {
if (newValue == "Process Knowledge/System Questions") {
g_form.addInfoMessage(country_name);
g_form.addInfoMessage("1");
g_form.removeOption('subcategory', 'L2 Support');
}
} else {
g_form.addOption('subcategory', 'L2 Support', 'L2 Support');
g_form.addInfoMessage('55');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 12:01 PM
Hi Samaksh,
My script is working on change of category , if you are talking about category in script , tried that also but not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 12:04 PM
Hello @Niharika14
Create a script include with the filter of choices you need and add this to Subcategory Reference Qualifier.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 12:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 12:22 PM
Where exactly is your script not working? If it is on catalog tasks, unfortunately this is a long known bug and servicenow still will not update the documentation.
add/removeOption does not work on change catalog tasks, only on the request item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 01:01 PM
Hi Markus,
It is working on catalog item only.