Element Descriptor

Pradnya6
Giga Contributor

Element Descriptor is not documented for calgary. Is there any latest documentation available? Prior to calgary I have used below code to get the choice table name from the field element.
var gr = new GlideRecord('cmdb_ci');
gr.get('254570386f7fcd0095d5f941be3ee48a');
var field = gr.getElement('os');
var ed = field.getED();
var choices = field.getChoices();
var choiceTable;
if (JSUtil.notNil(choices) && choices.size() > 0)
{
choiceTable = ed.getChoiceTable();
}

but some how this code is not working in calgary. Is there anything missing in the code? In calgary I am getting below error for above code.
Illegal access to method getChoiceTable() in class com.glide.db.ElementDescriptor

Please suggest.

5 REPLIES 5

The SN Nerd
Giga Sage
Giga Sage

var field = gr.getElement('os');
var choices = field.getChoices();

I had to write my own substitute function because it was at times only returning one or zero results, when it should have been returning multiple.



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022