- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2024 01:51 AM
Good Morning All,
I am trying to hid a choice value in the contact_type field on the case table. Here is my script in an onLoad client script, and it is not working, any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2024 03:25 AM - edited 05-24-2024 03:27 AM
Hi @Luke James The same script working for me. Please verify it is
1. You should only remove the option if it is not the currently-selected option when the form loads.
2. You can try to add alert in that onLoad and check whether it is running?
3.Is there any other onload or ui policy which shows that option. check that
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1641021
Regards,
Sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2024 03:25 AM - edited 05-24-2024 03:27 AM
Hi @Luke James The same script working for me. Please verify it is
1. You should only remove the option if it is not the currently-selected option when the form loads.
2. You can try to add alert in that onLoad and check whether it is running?
3.Is there any other onload or ui policy which shows that option. check that
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1641021
Regards,
Sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2024 03:32 AM - edited 05-24-2024 03:32 AM
Hi,
Make sure that the ui type field on your client script is set to all
Also, when you hide a choice type you have to be careful that is is not already selected, else it will be blank it out
So something like below
function onLoad() {
if(g_form.getValue('contact_type')!='self-service')
g_form.removeOption('contact_type', 'self-service');
}