Description
For forms where variables are shown, for example, sc_req_item, using removeOption in a client script to remove an option from a variable field in a client script will not work.
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.
For more information, see the product documentation topic Client script access to variable fields on task records.
Related Problem: PRB626041