- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2020 07:23 AM
I am trying to disable certain multiple choice options on onload for catalog item.
Tried the below but did not work:
var form = typeof g_sc_form != "undefined" ? g_sc_form : g_form;
form.removeOption(<fieldName>, <choiceValue>);
and
g_form.removeOption(<fieldName>, <choiceValue>
);
Any ideas on how to get this working?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 04:23 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2020 07:51 AM
Hi,
you can use this syntax to remove the option
g_form.removeOption('variableName', choiceValue);
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
04-05-2020 06:51 AM
Used the same format, did not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2020 07:04 AM
Hi,
Can you share the complete script and the choice values as well?
Regards
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
04-05-2020 07:18 AM
Hi
Make a catalog UI policy for that item that has the following script:
if you want to remove some specific roles then you can use the following script by clicking on script option of
Ui policy.
if(!g_user.hasRoles('role1','role2',......)){
g_form.removeOption('field', 'value');
}
Otherwise u directly use following syntax:
g_form.removeOption('Field_name', 'Choice_name');// Example
for more detail refer the following thread.
Removing or Disabling Choice List Options
If it help mark helpful or correct
Thanks and regards
Anil