GlideElementDescriptor - Scoped, Global
The GlideElementDescriptor API provides information about individual fields in a glide record.
There is no constructor for this class. Use the GlideElement or GlideRecord getED() method to obtain a GlideElementDescriptor object.
GlideElementDescriptor - getAttachmentEncryptionType()
Returns the encryption type used for attachments on the element's table.
This method is for use with the Edge Encryption plugin.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | The encryption type used on attachments. Returns null if attachments on the element's table are not being encrypted. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isEdge = ed.getAttachmentEncryptionType();
gs.info(isEdge);
Output:
null
GlideElementDescriptor - getEncryptionType()
Returns the element's encryption type.
This method is for use with the Edge Encryption plugin.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | The element's encryption type. Returns null if the element is not encrypted. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
sEdge = ed.getEncryptionType();
gs.info(isEdge);
Output:
null
GlideElementDescriptor - getInternalType()
Returns the element's internal data type.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | The element's internal data type. Possible values:
|
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isEdge = ed.getInternalType();
gs.info(isEdge);
integerGlideElementDescriptor - getLabel()
Returns the element's label.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | The element's label. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isEdge = ed.getLabel();
gs.info(isEdge);
Output:
Priority
GlideElementDescriptor - getLength()
Returns the element's length.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Number | The element's size. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isEdge = ed.getLength();
gs.info(isEdge);
Output:
40
GlideElementDescriptor - getName()
Returns the element's name.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | The element's name. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isEdge = ed.getName();
gs.info(isEdge);
Output:
priority
GlideElementDescriptor - getPlural()
Returns the element's plural label.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | The element's plural label. |
var now_GR = new GlideRecord('incident');
now_GR.query();
var ed = now_GR.getED();
gs.info(ed.getPlural());
Output:
Incidents
GlideElementDescriptor - hasAttachmentsEncrypted()
Returns true if an encrypted attachment has been added to the table.
This method is for use with the Edge Encryption plugin.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Boolean | Returns true if an encrypted attachment has been added to the table. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isEdge = ed.hasAttachmentsEncrypted();
gs.info(isEdge);
Output:
false
GlideElementDescriptor - isAutoOrSysID()
Returns true if the element is an automatically generated or system field.
Automatically generated and system fields cannot be encrypted. This method is for use with the Edge Encryption plugin.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Boolean | True if the element is automatically generated or a system field. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
isEdge = ed.isAutoOrSysID();
gs.info(isEdge);
Output:
false
GlideElementDescriptor - isChoiceTable()
Returns true if the element is defined as a dropdown choice in its dictionary definition.
Choice fields cannnot be encrypted.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Boolean | Returns true if the element is defined as a dropdown choice. Returns true even if there are no entries defined in the choice table. The last choice type, suggestion, does not return true. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isChoiceTable = ed.isChoiceTable();
gs.info(isChoiceTable);
Output:
true
GlideElementDescriptor - isEdgeEncrypted()
Returns true if an element is encrypted.
This method is for use with the Edge Encryption plugin.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Boolean | Returns true if the element is encrypted, false otherwise. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isEdge = ed.isEdgeEncrypted();
gs.info(isEdge)
Output:
false
GlideElementDescriptor - isMandatory()
Determines whether the element is mandatory and must contain a value before the record can be saved.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Boolean | Flag that indicates whether the associated element is mandatory and must contain a value before the record containing the element can be saved. Possible values:
|
This example shows how to check whether the name field is mandatory.
var isRecordValid;
var now_GR = new GlideRecord('my_table');
var field = now_GR.getElement('name');
var elementDescriptor = field.getED();
now_GR.query();
while (now_GR.next()) {
if (elementDescriptor.isMandatory() && !now_GR.name) {
isRecordValid = false;
}
}
GlideElementDescriptor - isVirtual()
Returns true if the element is a virtual element.
A virtual element is a calculated field as set by the dictionary definition of the field. Virtual fields cannot be encrypted.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Boolean | Returns true if the element is a virtual element. |
var grInc = new GlideRecord('incident');
grInc.query('priority', '1');
var field = grInc.getElement('priority');
var ed = field.getED();
var isVirtual = ed.isVirtual();
gs.info(isVirtual);
Output:
false