web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

How to get option set text using value in c# plugin dynamic 365

(0) ShareShare
ReportReport
Posted on by 35

Hi,

I have a optionset value - 867400005


Now I want optionset lable or text of the option whose value is  867400005

Please help me to achive this

Thanks,

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: How to get option set text using value in c# plugin dynamic 365

    Hi,

    You need to use formatted value to get the text from optionset field

    nishantrana.me/.../

  • Suggested answer
    - Matt Bayes - Profile Picture
    890 on at
    RE: How to get option set text using value in c# plugin dynamic 365

    Hi Praajna,

    There are some out-of-box messages that can be used in C# to retrieve the text of the option set.

    Generally, you can use the RetrieveOptionSetRequest message to get the option set and its metadata, then from there filter out the options to the one with the desired value.
    The option set metadata should contain a label for that specific option which you can then use.

    Here's a blog outlining how to get the text of the option set:
    https://thabisomotloung.wordpress.com/2015/04/16/get-optionset-text-using-c/

    Another option, depending on your requirement, is if you leverage Early Bound Classes in your C# plugin, you can convert the associated enum based on the value to text, although this option removes all formatting from the text, for example:  string statusReasonText = ((Contact_StatusCode)867400005).toString()

    This would display, for example, the option "Needs Investigation" as "NeedsInvestigation" - the full name without the spaces/whitespace.

    Hope this helps and gives you some direction!

    Thanks!

    Matt Bayes

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 122

#2
DAnny3211 Profile Picture

DAnny3211 101

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans