Using External Value property of Choice / Option Set Field for Integration – Dynamics 365 / Dataverse


When working with Choice fields (Option Sets) in Dataverse, we mostly use the label and internal numeric value. But there’s also a lesser-known property — External Value — which can be quite handy, especially in integration scenarios.

Below is the Priority column of the case table.

A screenshot of a computer

AI-generated content may be incorrect.

We have Severe, Moderate, and Minor external values specified for High, Normal, and Low choices respectively. These external values could be how the external third-party system is tracking the priority values to which we are integrating.

The external system sends us “priority”:” high” and we map that to the internal value 1 in Dataverse.

While sending data to the external system we convert the internal value to the external code i.e. 1 to. High

Below is how we can read the external values.

     var myServiceClient = new CrmServiceClient(connectionString);     

        if (myServiceClient.IsReady)
        {
            var request = new RetrieveAttributeRequest
            {
                EntityLogicalName = "incident",
                LogicalName = "prioritycode",
                RetrieveAsIfPublished = true
            };

            var response = (RetrieveAttributeResponse)myServiceClient.Execute(request);
            var picklistMetadata = (PicklistAttributeMetadata)response.AttributeMetadata;

            foreach (var option in picklistMetadata.OptionSet.Options)
            {
                Console.WriteLine($"Value: {option.Value}, Label: {option.Label?.UserLocalizedLabel?.Label}, External: {option.ExternalValue}");
            }

            string ext = "Severe";
            var match = picklistMetadata.OptionSet.Options.FirstOrDefault(o => o.ExternalValue == ext);
            if (match != null)
            {
                Console.WriteLine($"\nExternal '{ext}' maps to Value {match.Value}");
            }

        }
A screenshot of a computer

AI-generated content may be incorrect.

Using External values, we can decouple integrations from the internal values that we use for our choice column. By using them, we can speak the language of the external system while still maintaining proper structure and metadata within Dataverse.

Hope it helps..

Advertisements

Understanding the Hidden Property for Choice Datatype in Dataverse / Dynamics 365


Dataverse provides a flexible way to manage data through choice (option set) fields. One of the newer enhancements is the Hidden property, which allows administrators to hide specific choice values from selection while retaining them in the system.

To see it in action,

Navigate to Dataverse Table Designer in the Power Apps Maker Portal, and select the Choice (Option Set) field.

Here we have selected the Origin choice field of the Case table.

We have selected the Twitter choice value.

A screenshot of a computer

AI-generated content may be incorrect.

Click on a particular choice value and open Additional Properties, check the Hidden checkbox, and save and publish the changes.

A screenshot of a computer

AI-generated content may be incorrect.

After applying these settings,

  • Hidden choice values will not appear in dropdown lists when users create or update records.
A screenshot of a computer

AI-generated content may be incorrect.

Existing records with hidden values will still display them in forms and views.

A screenshot of a computer

AI-generated content may be incorrect.

We can see the option greyed out for the record having that existing hidden value.

A screenshot of a computer

AI-generated content may be incorrect.
  • Business rules and workflows can still reference hidden values.
  • The hidden choice remains in the metadata and can be retrieved using FetchXML, OData, or SDK queries.
  • Power Automate flows triggered on record updates will still recognize hidden values.

We can use this new feature for the deprecating values that should no longer be used but still need to exist in historical data. Also, we need to communicate changes to users to prevent confusion when certain values disappear from selection lists. And finally, we should consider data migration and cleanup if a value should never be used again.

Thus, the Hidden property for choice fields in Dataverse provides a powerful way for us to manage choice options dynamically without affecting existing records. By leveraging this feature, we can ensure a smoother transition when phasing out obsolete values while maintaining data integrity.

Hope it helps..

Advertisements