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" you can also access field details such as picklist values and more.
In order to access Entity metadata, use one of the following methods:
// DiscribeEntity<T> where T is name of the Entity, e.g:var metadata = dbObject.DescribeEntity<Account>();
// You can also ask the system to describe an Entity dynamicallyvar 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 name of the Entity, e.g:var metadata = dbObject.DescribeEntity<Account>(true);
// you can also ask the system to describe an Entity dynamicallyvar metadata = dbObject.DescribeEntity("Account", true);
Entity Metadata Properties
| Property | Property Type | Notes |
|---|
| Id | string | |
| Name | string | |
| Label | string | Translated to the current user's preferred language |
| PluralLabel | string | Translated to the current user's preferred language |
| KeyPrefix | string | |
| TracksFeeds | bool | |
| 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 | |
| Name | string | |
| Label | string | Translated to the current user's preferred language |
| IsKey | bool | |
| IsSearchable | bool | |
| IsReadable | bool | |
| IsReference | bool | |
| IsAuditField | bool | |
| IsReadOnly | bool | |
| IsRequired | bool | |
| IsExternalId | bool | |
| IsCalculated | bool | |
| IsNameField | bool | |
| IsCustomField | bool | |
| ReferenceField | string | |
| IsAudited | bool | |
| IsSortable | bool | |
| IsFilterable | bool | |
| IsUnique | bool | |
| IsHtml | bool | |
| Length | int | |
| Precision | int | |
| IsDepedentPicklist | bool | |
| ControllerName | string | |
| PicklistEntries | List<PicklistEntry> | |
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 Database. |
| ExternalValue | string | |
| IsDefaultValue | bool | |
| Color | string | HEX color value (e.g: #336699) |
| IsDecision | bool | Used in special use-cases where the picklist value has a certain meaning, such as "Closed" for "Task" means the task is closed and not open anymore. |