Service Board > Max for Developers > Max Groovy APIs > Retrieve Object Metadata API
Retrieve Object Metadata API
To access Max metadata for Objects, fields, and so on, you use the Groovy utility class com.servicemax.core.utils.Definitions.
To work with the methods in this API for which usage examples are listed below, import the following Groovy class:
import com.servicemax.core.utils.Definitions;
Get a Namespace Definition
com.intalio.core.seed.api.IEntityNamespaceDefinition namespace = Definitions.getNamespace('io')
Get a Namespace Name
namespace.getFieldValue("io_name")
Get Object Definition With Fields, or Get Field and Associated Data Type
To retrieve the Account object:
com.intalio.core.seed.api.IEntityManagerDefinition objectDefinition = Definitions.getObjectDefinition('core_account')
Retrieve All Fields From Object Definition as a Collection
Collection<com.intalio.core.seed.api.IEntityFieldDefinition> listOfFields = objectDefinition.getFieldDefinitions()
Retrieve All Fields for core_account Directly From Definitions Class
Collection<com.intalio.core.seed.api.IEntityFieldDefinition> fieldsDefinitions = Definitions.getFieldDefinition('core_account');
Get Fields List Size
listOfFields.size()
Get Account’s Description Field From objectDefinition
com.intalio.core.seed.api.IEntityFieldDefinition descripField = objectDefinition.getFieldDefinition('io_description')
Get Account Object’s Description Field Directly From Definitions Class
com.intalio.core.seed.api.IEntityFieldDefinition descripField = Definitions.getFieldDefinition('core_account','io_description')
Get Description Field’s Data Type From the Field
com.intalio.core.seed.api.IEntityDatatypeDefinition datatypeOfDescriptionField = descripField.getDatatype()
Get Description Field’s Data Type Directly From Definitions Class
com.intalio.core.seed.api.IEntityDatatypeDefinition datatypeOfDescriptionField = Definitions.getDatatype('io_account', 'io_description')
Get Specified Relationship
com.intalio.core.seed.api.IEntityRelationshipDefinition relationshipToUser = Definitions.getRelationship("io_fields")
Get Option List Field for Specified Object (Showcase)
com.intalio.core.seed.api.IEntityFieldDefinition showcasePicklistField = Definitions.getFieldDefinition('io_showcase','io_showcase_option_list')
Get Options for Specified Option List (Showcase Object)
List<com.intalio.core.data.api.IOption> options = Definitions.getActiveOptions('io_showcase','io_showcase_option_list')
Get Field Options for Specified Field (Showcase Number)
com.intalio.core.seed.api.IEntityFieldDefinition showcaseNumberField = Definitions.getFieldDefinition('io_showcase', 'io_showcase_number')
Get Field Options for Specified Field (showcaseNumberField) From fieldDefinition
Collection<com.intalio.core.seed.api.IEntityFieldOptionDefinition> fieldOptionsOfShowcaseNumberField = showcaseNumberField.getOptions()
Get Field Options for a Specified Field (showcaseNumberField) Directly From Definitions Class
Collection<com.intalio.core.seed.api.IEntityFieldOptionDefinition> fieldOptionsOfShowcaseNumberField = Definitions.getFieldOptions('io_showcase','io_showcase_number')
For more information:
Was this helpful?