g_form.removeOption not working as expected on onLoad client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 01:39 AM
Hi, I am trying to hide 2 question choice options that are not required temporariliy.
I am trying to use the g_form.removeOption but I cannot get this to work. I am not sure if this is because of what I am doing...
I am using the below... where u_access_type is the question field and loss and profit are the value of the option.
function onLoad() {
g_form.removeOption('u_access_type', 'loss');
g_form.removeOption('u_access_type', 'profit');
}
Any help appreciated!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 02:19 AM
Hi Shamir,
Did you use proper choice values for hiding i.e. profit and loss. check that once
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
01-10-2019 02:27 AM
Hi
follow link: Removing/Disabling options
Please: Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 02:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 02:27 AM
Hi Shamir,
Can you try to add alert in that onLoad and check whether it is running?
Is there any other onload or ui policy which shows that option. check that
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader