How to get label of choice field in Dataverse Plugin
When working with Dataverse, you may need to retrieve the label of a choice column in a plugin instead of the underlying integer value. The labels provide more meaningful information to end-users than the integer values. In this post, I’ll walk you through how to achieve this in a Dataverse plugin.
What is a Choice Column in Dataverse?
A Choice (also known as Option Set) column in Dataverse allows users to pick values from a predefined list. Under the hood, Dataverse stores these selections as integers, with each integer representing a specific label.
For example, consider a column named Status
:
- 1 = Active
- 2 = Inactive
While these integer values are useful for processing in plugins, you’ll often need to present or log the label to make the plugin output user-friendly.
Watch the video to learn. You ahve to use myval=entity.FormattedValues[“<choicefieldlogicalname>”];
Hope it helps.