g_form.removeOption() is not working in multirow variable set catalog client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
We have a catalog client script on MRVS to hide drop choice based on users cost center. But choice is not getting removed even after adding a catalig client script.
Sample code :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you are using wrong method removeOptionByLabel
correct one is this
g_form.removeOption('actor_type', 'choice value'); // give your choice value
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Ankur,
I have tried g_form.removeOption('actor_type', 'choice value'); // give your choice value, didn't worked.
Thanks
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @GopiKrishna Sir ,
Can you please check this method :
g_sc_form.removeOption('test_var', 'choice_one');
You can refer this : https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0678206
If above link not works then its content is already mentioned below please check this :
Note that the catalog client script has no issues with this method when running on com.glideapp.servicecatalog_cat_item_view.do.
Steps to Reproduce
Go to the sc_req_item table and go to the Blackberry catalog item.
Add a new variable select box named "test_var".
For more information, see the product documentation topic Create a Service Catalog variable.
Add three choices to the variable named "choice_one", "choice_two", and "choice_three".
Create a new client script with the following values:
Type: onLoad
Table: sc_req_item
Script:
function onLoad() {
g_form.removeOption('variables.test_var','choice_one');
}
Submit a new Blackberry catalog.
Go to the request item form.
The test_var variable should contain only two choices but three choices are available including choice_one, which should have been removed.
Workaround: g_sc_form.removeOption('test_var', 'choice_one');
Workaround
Note that only the following APIs are supported:
g_form.setDisplay(name, display)
g_form.setVisible(name, visibility)
g_form.setMandatory(name, mandatory)
g_form.setValue(name, value, display_value)
g_form.getValue(name)
g_form.setReadOnly(fieldName, boolean)
g_form.removeOption is not supported.
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya,
Technical Consultant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @GopiKrishna Sir ,
I hope you are doing well . Does my response helps you ?
If my response helps you then you cam mark it as helpful and accept as solution. This will helps further future queries.
Regards,
Aditya,
Technical Consultant

