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

kedarnath13
Kilo Explorer

Is there any Documentation available on wiki or some other place to look for Element Descriptor?

and what getChoiceTable will do?


MKhan1
Giga Contributor

Why do you need to get all the choices of a field?. Can you explain please


The SN Nerd
Giga Sage
Giga Sage

Methods:
function addDictionaryItem
function canAvg
function canCreate
function canMax
function canMin
function canPublicRead
function canPublicWrite
function canRead
function canSum
function canWrite
function Clone
function compareTo
function createIndex
function dropIndex
function equals
function getAttribute
function getAttributes
function getBooleanAttribute
function getCalculation
function getChoice
function getChoiceField
function getChoiceTable
function getClass
function getColumnName
function getCreateRoles
function getDefault
function getDefinition
function getDeleteRoles
function getDependent
function getDynamicCreationScript
function getElementLabel
function getFieldLabel
function getForeignDatabase
function getHelp
function getHint
function getInternalType
function getLabel
function getLength
function getMaxLength
function getMetaData
function getMetaDataXML
function getName
function getNumericAttribute
function getPlural
function getReadRoles
function getReference
function getReferenceCascadeRule
function getReferenceElement
function getReferenceKey
function getReferenceQualifier
function getReferenceQualifierQuery
function getScale
function getSizeClass
function getSqlLength
function getTableName
function getTargetTable
function getType
function getUniqueID
function getURL
function getURLTarget
function getWidget
function getWriteRoles
function hasAttribute
function hashCode
function isActive
function isArray
function isAudit
function isBoolean
function isChoiceTable
function isCurrency
function isDateOnly
function isDateType
function isDecimal
function isDisplay
function isDocumentID
function isDomainID
function isDuration
function isDynamicCreate
function isElementReference
function isEncodedQuery
function isFilterable
function isFloat
function isGroupable
function isInDatabase
function isInDictionary
function isInteger
function isIntegerOrDecimal
function isJournal
function isJournalList
function isList
function isMandatory
function isMatchable
function isMultiText
function isNumber
function isNumeric
function isObject
function isObjectVerified
function isPrice
function isPrimaryKey
function isReadOnly
function isReference
function isReferenceExt
function isReferenceFloats
function isSequence
function isSortable
function isSpellCheck
function isString
function isTableReference
function isTextIndex
function isTimeType
function isTrulyNumber
function isUnique
function isUserPref
function isVirtual
function isXMLView
function mergeAttributes
function mergeAttributesWithTables
function needsIndex
function notify
function notifyAll
function serializeAttributes
function setAttribute
function setAttributes
function setChoice
function setChoiceField
function setChoiceTable
function setColumnName
function setDependent
function setDisplay
function setFieldLabel
function setInternalType
function setIsObject
function setIsReference
function setLabel
function setLength
function setMandatory
function setMandatoryOverride
function setName
function setNeedsIndex
function setNotObject
function setReference
function setReferenceCascadeRule
function setReferenceElement
function setReferenceFloats
function setReferenceKey
function setReferenceQualifier
function setScale
function setSizeClass
function setSortable
function setTableName
function setTextIndex
function setType
function setVirtual
function toSQL
function toSQLType
function toString
function toXML
function wait

Properties:
active
array
attributes
audit
boolean
calculation
choice
choiceField
choiceTable
class
columnName
createRoles
currency
dateOnly
dateType
decimal
default
deleteRoles
dependent
display
documentID
domainID
duration
dynamicCreate
dynamicCreationScript
elementLabel
elementReference
encodedQuery
fieldLabel
filterable
float
foreignDatabase
groupable
help
hint
inDatabase
inDictionary
integer
integerOrDecimal
internalType
journal
journalList
label
length
list
mandatory
matchable
metaData
multiText
name
number
numeric
object
objectVerified
plural
price
primaryKey
readOnly
readRoles
reference
referenceCascadeRule
referenceElement
referenceExt
referenceFloats
referenceKey
scale
sequence
sizeClass
sortable
spellCheck
sqlLength
string
tableName
tableReference
textIndex
timeType
trulyNumber
type
unique
uniqueID
URL
URLTarget
userPref
virtual
widget
writeRoles
XMLView

More doco: http://servicenowcookbook.com/w/index.php/Element_Descriptor



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

Which one do I use to get the reference_field_max_length to build XML schema?



I can't get getMaxLength to work...