g_form.addOption() method creating a duplicate value after the form is saved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2022 01:45 AM
Hi
I am new to serviceNow.
I am trying to add an option using g_form.addOption() method. This is adding the option. However, I have few questions related to this. Please help me to understand this concept
1. Choice added from addOption() method is not visible in sys_choice table. Is this expected behaviour ?
2. When I am trying to add an option to impact field on Incident table, it has added the choice but when the user selects the new option and tries to save it then the choice value is creating a duplicate.
1. One value is 10
2. Second Value is 10 – Super Low
May I know how to address this. Please refer to the below screenshot
Here is the ClientScript
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.addOption(‘impact’, ’10’ , ’10 – Super Low’);
}
Thanks
Kiran
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2022 01:48 AM
Hi I believe that is because you have 2 choice values with 10
1. 10
2. 10 - Super Low
delete the one you dont require.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2022 02:00 AM
Hi Harish
Thanks for your response
There is only one option I have added i.e., '10 - Super Low'. The other choice 10 is created automatically, after I select the option '10 - Super Low' in impact field on an incident and saved the form.
Am I missing anything ?
Thanks
Kiran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2022 02:10 AM
try the below
g_form.addOption(‘impact’, ’10 – Super Low’ , ’10 – Super Low’);
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2025 09:32 AM
Hi Kiran,
I know this may be very late reply for your question, still I'll try to address the query if it is not resolved yet.
1) May I know, how you've added these options to the dropdown [ if through script, can I have snips please]
2)As I'm recently faced, g_form.addOption is not allowing me to add duplicate values to the dropdown.
By checking the script or method that how you've configured the dropdown would be really helpful for further coordination.
Thanks