Entity Metadata
Using the entity metadata, you can describe an Entity and access its properties, such as entity labels, settings and their fields. Using the "Describe" method, you can also access field details such as picklist values and more.
Accessing Metadata
To access Entity metadata, use one of the following methods:
// DiscribeEntity<T> where T is the name of the Entity, e.g:
var metadata = dbObject.DescribeEntity<Account>();
// You can also ask the system to describe an Entity dynamically
var metadata = dbObject.DescribeEntity("Account");
The above sample describes an entity using the current user's permission. Therefore, it would not return fields that the user does not have access to view. If you wish to retrieve the entity details in system mode (where end-user's permissions are ignored), you use the following methods:
// DiscribeEntity<T> where T is the name of the Entity, e.g:
var metadata = dbObject.DescribeEntity<Account>(true);
// You can also ask the system to describe an Entity dynamically
var metadata = dbObject.DescribeEntity("Account", true);
Entity Metadata Properties
| Property | Property Type | Notes |
|---|
| Id | string | Entity record ID |
| Name | string | Entity API Name |
| Label | string | Translated to the current user's preferred language |
| PluralLabel | string | Translated to the current user's preferred language |
| KeyPrefix | string | The prefix used for creating an entity's Record IDs |
| TracksFeeds | bool | Status of social feeds for this entity |
| AllowReports | bool | |
| TrackActivities | bool | |
| Fields | List<EntityFieldMetadata> | List of fields of the entity |
| Relationships | List<EntityRelationshipMetadata> | Relationships are other entities that reference this entity |
Entity Field Metadata Properties
| Property | Property Type | |
|---|
| Id | string | The unique identifier for the field within the system. |
| Name | string | The API/programmatic name of the field used in queries and data operations. |
| Label | string | The user-friendly display name of the field, translated to the current user's preferred language. |
| IsKey | bool | Indicates whether this field is the primary key of the entity |
| IsSearchable | bool | Indicates whether the field is indexed and can be used in search operations. |
| IsReadable | bool | Indicates whether the current user has permission to view this field's value. |
| IsReference | bool | Indicates whether this field is a lookup/master-detail field that points to another entity. |
| IsAuditField | bool | Indicates whether this is a system audit field (e.g., CreatedOn, ModifiedOn, CreatedById, ModifiedById). |
| IsReadOnly | bool | Indicates whether the field is read-only and cannot be modified by users. |
| IsRequired | bool | Indicates whether a value must be provided for this field when creating or updating records. |
| IsExternalId | bool | Indicates whether this field can be used as an external identifier for upsert operations and integrations with external systems. |
| IsCalculated | bool | Indicates whether this is a computed field whose value is derived automatically (formula, rollup summary, or calculated field). Calculated fields are always read-only. |
| IsNameField | bool | Indicates whether this field serves as the primary display name for records of this entity. |
| IsCustomField | bool | Indicates whether this is a custom field created by an administrator, as opposed to a standard system field. |
| ReferenceField | string | For lookup or master-detail fields, the name of the navigation property that provides access to the related entity's data. Use this to access fields from the related entity (e.g., {ReferenceField}.Name). |
| IsAudited | bool | Indicates whether changes to this field are tracked in the audit history. |
| IsSortable | bool | Indicates whether query results can be sorted by this field. |
| IsFilterable | bool | Indicates whether this field can be used in filter or WHERE conditions. |
| IsUnique | bool | Indicates whether this field has a unique constraint, preventing duplicate values across records. |
| IsHtml | bool | Indicates whether the field contains HTML/rich text content that should be rendered as formatted HTML. |
| Length | int | The maximum character length allowed for text fields and the number of whole digits for numeric or currency fields. |
| Precision | int | The number of decimal places for numeric fields (currency, decimal, percentage). |
| IsDepedentPicklist | bool | Indicates whether the available values for this picklist depend on the selected value of another controlling field. |
| ControllerName | string | For dependent picklists, the name of the controlling field that determines which values are available in this picklist. |
| PicklistEntries | List<PicklistEntry> | The list of available values for picklist/dropdown fields. Each entry includes a label (display text), value (stored value), optional color, and default value indicator. |
Picklist Entry Properties
| Property | Property Type | Notes |
|---|
| Label | string | Translated to the current user's preferred language |
| Value | string | The actual value that should be stored in the database. |
| ExternalValue | string | Unique identifier of the picklist in an external system. |
| IsDefaultValue | bool | If this value should be set as the default value. |
| Color | string | HEX color value (e.g: #336699) |
| IsDecision | bool | Used in special cases where a picklist value requires additional meaning—for example, identifying whether an opportunity stage represents a closed opportunity. |
Accessing Record Type Metadata
You can request metadata to load additional information related to Record Types.
This data is not loaded by default due to performance considerations and should only be requested when needed.
var metadata = dbObject.DescribeEntity<Account>(true);
// Loads the additional Record Type metadata for this entity.
metadata.LoadRecordTypeMetadata();
Record Types Metadata Properties
| Property | Property Type | Notes |
|---|
| Id | string | Unique ID of Record Type |
| Name | string | Name of the Record Type |
| Description | string | Record Type's description |
| IsActive | bool | Record Type status |
| ExternalId | string | The ID of the Record Type in an external system |
| RecordTypePicklistSettings | object[] | An array of objects for different Picklist fields for this Record Type |
Record Type Picklist Settings Metadata Properties
| Property | Property Type | Notes |
|---|
| Id | string | Settings' unique ID |
| EntityField | string | Name of the picklist field |
| Values | string[] | An array of string picklist values that apply to this Record Type |
| DefaultValue | string | Default value specified for this Record Type |
Accessing Dependent Picklist Metadata
You may optionally request metadata for Dependent Picklist values for advanced component development or other specialized requirements. This metadata is not always included when calling the Describe method and must be explicitly requested.
var metadata = dbObject.DescribeEntity<Account>(true);
// Load dependent picklist values
metadata.LoadDepedentPicklistValues();
The Entity Field Metadata property IsDependentPicklist indicates whether a picklist depends on a controlling field, such as a checkbox or another picklist. The ControllerName property identifies the controlling field.
When dependent picklist metadata is loaded, a new object called DependentPicklists is added to the field metadata for fields where IsDependentPicklist is set to true. This object maps each parent (controlling) picklist value to the list of valid child picklist values.
Below is an example showing that when the controlling value is “Type value 1”, only “Open” and “In Progress” are valid child values:
{
"Id": "7NX0000000007MQ0000",
"Name": "Status",
"Label": "Status",
"FieldType": "Picklist",
"IsDependentPicklist": true,
"ControllerName": "Type"
...
"DependentPicklists": {
"Type value 1": [
{
"Id": "7O0000000000hIA0000",
"Label": "Open (New)",
"Value": "Open",
...
},
{
"Id": "7O0000000000hIA0000",
"Label": "In Progress",
"Value": "In Progress",
...
}
]
}
}
Dependent Picklists Properties
| Property | Property Type | Notes |
|---|
| Id | string | Unique identifier for the Picklist value. |
| Label | string | Label of the picklist (differs based on user's language settings) |
| Value | string | Value of the picklist (as it is stored in the database) |
| ExternalValue | string | Unique identifier of the picklist in an external system. |
| IsDefaultValue | bool | If this value should be set as the default value. |
| Color | string | Color associated with this picklist value |
| IsDecision | bool | Used in special cases where a picklist value requires additional meaning—for example, identifying whether an opportunity stage represents a closed opportunity. |
| IsDecision2 | bool | Used in special cases where a picklist value carries additional meaning—for example, indicating whether an opportunity stage represents a won opportunity. |