removing options in a dropdown
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 10:54 AM
Hey all,
I cant work out why my scripts are not working. i need to do this this on two different tables/locations
1. Catalog item. I need to remove an option dependent on the answer to the previous question. my script is below, I have changed this several times but cant work out what is wong with my script. I guess the first question is can this be done on a catalog item?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
var ecms_mob = g_form.getValue('ecms_mobile');
if (ecms_mob =='No'){
g_form.removeOption('device_type', 'Smartphone');
}
}
2. Removing resolved as an option based on an incident being a new ticket.
function onLoad() {
if (g_form.isNewRecord())
g_form.removeOption("state", 6);
}
I have been going around in circles on these, if someone could point out the problem it would be most appreciated.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 12:45 PM
So, we are almost there! thanks so much,
The only thing i know they will complain about is when smartphone is remove
its replaced with -none- which is already included (and has to be) so i now
get
-none-
-none-
Tablet
Laptop
Any thoughts?
On 9 March 2017 at 20:40, mallen_nspi <community-no-reply@servicenow.com>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 05:23 PM
maybe its a cache thing?
dont forget the else part to addoption...
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#addOption