CRM 2011 Get OptionSetValue Label Text

In CRM 2011, when you try to get the value of an OptionSet, you will always get an Integer value instead of the label value.

I found out that you have to use RetrieveAttributeRequest and get the OptionMetadata in order to get the label text of a given value. This is intended so that it supports multiple languages.

Therefore I created a service extension method in order to get the label from the OptionSet:



To use this you just need to pass in the Entity, the OptionSet attribute you're looking for, and the Option Value you want to get the label from:

Example (early bound):



Hope this helps,
Andreas

Comments

Post a Comment

Popular posts from this blog

SharePoint 2013 anonymous access add attachments to list item

CRM Plugin - Parent and Child Pipeline

Sitecore custom publish agent from specific node and at a specific time