Notifications

4026 views

Description



Description


These are a few things to remember when working with addOption method

Procedure



- create an onChange client script 
- You would then need to use g_form.addOption(), on the category field to populate the choices. 
- You would gliderecord query the [sys_choice] or [question_choice] table for your choices, and example of such a script can be found here towards the bottom of the article: 
https://www.jds.net.au/servicenow-choice-list-dependencies/ 
- To clear out the options from the Category field, you'll have to use either clearOptions or the removeOption() methods. You can read more about this on our developer's site: 
https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=r_GlideFormClearOptions_String 
- When you add the "none" choice back, are you using something like: 
g_form.addOption('subcategory', '' , '-- None --'); 
- Also if the field is set to mandatory, you can turn it off by using the following client-side method: 
g_form.setMandatory(String fieldName, Boolean mandatory); 
https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=r_GlideFormSetMandatory_String_Boolean 

Article Information

Last Updated:2020-01-28 17:52:09
Published:2020-01-29