Microsoft Dynamics CRM

{Quick Tip} When you need option set text value inside your plugin in Dynamics CRM

Normally when a developer in CRM goes to check Option set value only finds out that the Option Set is stored

as an integer and to get the string value normally people use methods like this one:

Look at the approach at this link:

http://stackoverflow.com/questions/24873581/get-the-string-value-from-optionsetvalue-in-crm-plugin

Doing a metadata call for this.

Metadata calls are more time consuming than value already available in memory.

clip_image001

Well CRM does provide a direct way if you have the entity already retrieved, which most oldies in CRM know:

string optionSetText = entity.FormattedValues[“optionsetname”];

Hope it helps and Happy CRMing!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s