It is not unusual to run into a business requirement where you need to extract Dynamics 365 metadata during your ETL process. We used to believe that this was not a general requirement until we recently announced our DES deprecation replacement solution, in which it is important to have a way to retrieve the list of Option Set values along with their label values in the system since Dynamics Entity Changes feature only returns integer values for those set/picklist options.
Recognizing this business requirement, we have recently shipped a new source type in the CRM/CDS source component in our most recent 2022 release wave 1 (v22.1), which allows you to retrieve the following metadata from the system.
- Entity Metadata
- Field Metadata
- Lookup Metadata
- OptionSet Metadata
We will dive into each source type and provide you with a quick overview of the information that you receive within each source option.
Entity Metadata
Using the EntityMetadata option, you will receive a list of all entities in the Dataverse/CDS/CRM system, with the following properties returned (this list may change from version to version in the future). We have added a couple of highlights; all other properties should be self-explanatory.
- LogicalName
- ActivityTypeMask
- AutoRouteToOwnerQueue
- CanTriggerWorkflow
- Description
- DisplayName
- EntityHelpUrlEnabled
- EntityHelpUrl
- IsDocumentManagementEnabled
- IsOneNoteIntegrationEnabled
- IsInteractionCentricEnabled
- IsKnowledgeManagementEnabled
- IsSLAEnabled
- IsBPFEntity
- IsDocumentRecommendationsEnabled
- AutoCreateAccessTeams
- IsActivity
- IsActivityParty
- IsAuditEnabled
- IsAvailableOffline
- IsChildEntity
- IsAIRUpdated
- IsValidForQueue
- IsConnectionsEnabled
- IsCustomEntity
- IsBusinessProcessEnabled
- IsCustomizable
- IsRenameable
- IsMappable
- IsDuplicateDetectionEnabled
- CanCreateAttributes
- CanCreateForms
- CanCreateViews
- CanCreateCharts
- CanBeRelatedEntityInRelationship
- CanBePrimaryEntityInRelationship
- CanBeInManyToMany
- CanEnableSyncToExternalSearchIndex
- SyncToExternalSearchIndex
- CanModifyAdditionalSettings
- CanChangeHierarchicalRelationship
- IsOptimisticConcurrencyEnabled
- ChangeTrackingEnabled
- CanChangeTrackingBeEnabled
- IsImportable
- IsIntersect - this is true when it is a N:N relationship entity
- IsMailMergeEnabled
- IsManaged
- IsEnabledForCharts
- IsEnabledForTrace
- IsValidForAdvancedFind
- IsVisibleInMobile
- IsVisibleInMobileClient
- IsReadOnlyInMobileClient
- IsOfflineInMobileClient
- DaysSinceRecordLastModified
- MobileOfflineFilters
- IsReadingPaneEnabled
- IsQuickCreateEnabled
- ObjectTypeCode - this is the entity type code, it should be noted that entity type code could change between environments after the solution is promoted or deployed
- OwnershipType
- PrimaryNameAttribute
- PrimaryImageAttribute
- PrimaryIdAttribute
- RecurrenceBaseEntityLogicalName
- ReportViewName
- SchemaName
- IntroducedVersion
- IsStateModelAware
- EnforceStateTransitions
- EntityColor
- LogicalCollectionName
- CollectionSchemaName
- EntitySetName
- IsEnabledForExternalChannels
- IsPrivate
- UsesBusinessDataLabelTable
- IsLogicalEntity
Field Metadata
Using the FieldMetadata option, you will receive a list of all fields in the Dataverse/CDS/CRM system from all entities, with the following properties returned (again, this property list may change from version to version in the future). All properties should be self-explanatory.
- LogicalName
- AttributeOf
- AttributeType
- ColumnNumber
- Description
- DisplayName
- DeprecatedVersion
- IntroducedVersion
- EntityLogicalName
- IsAuditEnabled
- IsCustomAttribute
- IsPrimaryId
- IsPrimaryName
- IsValidForCreate
- IsValidForRead
- IsValidForUpdate
- CanBeSecuredForRead
- CanBeSecuredForCreate
- CanBeSecuredForUpdate
- IsSecured
- IsRetrievable
- IsFilterable
- IsSearchable
- IsManaged
- IsGlobalFilterEnabled
- IsSortableEnabled
- LinkedAttributeId
- IsCustomizable
- IsRenameable
- IsValidForAdvancedFind
- CanModifyAdditionalSettings
- SchemaName
- IsLogical
- InheritsFrom
- SourceType
Lookup Metadata
Using the LookupMetadata option, you will receive a list of all lookup fields in the Dataverse/CDS/CRM system from all entities, with the following properties returned. We have included a short description of each property below.
- EntityName - this is the entity’s LogicName
- FieldName - this should be the lookup field’s LogicalName
- ReferencedEntity - this is the entity that the lookup can reference to, note that some lookup fields can be multi-targeting, which means that you can expect a lookup field to have multiple rows returned with the ReferencedEntity being different between rows.
- ReferencedEntityPrimaryKeyField – this should be the lookup entity’s primary key field
OptionSet Metadata
Using the OptionSetMetadata option, you will receive a list of all option set values for each OptionSet or picklist field in the Dataverse/CDS/CRM system from all entities, with the following properties returned. We have included a short description of each property below.
- EntityName - this is the entity’s LogicName
- FieldName - this should be the OptionSet/picklist field’s LogicalName
- OptionValue - this contains the integer value of the option
- ParentOptionValue - this contains the integer value of the parent option. This is mainly used for statuscode field currently by storing its statecode value. Note that this field is not currently populated when using the WebAPI service endpoint.
- IsGlobal - this indicates whether it is a global option set.
- GlobalOptionSetName - this contains the global option set name if the above IsGlobal property is true.
- IsUserLocalizedLabel - this property indicates whether the localized label below is the localized version in the connection user's locale setting.
- LocalizedLabel - the localized label of the option
- LocalizedLabelLanguageCode – the language code of the localized label above.
It should be noted that for one option value, there could be multiple records in the above returned metadata, one has IsUserLocalizedLabel set to true while the other one(s) are for other languages that the system supports.
In working with the DES replacement solution, you would join any entity records with the OptionSetMetadata output in order to populate those option set localized label values.
We hope you find this useful.