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

1 comments:

very useful

thanks :)

Reply

Post a Comment