{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

{C# 6.0 and VS 2015 Quick Tip} Coding Superpowers for CRM developers – Part 3 Code Lens for VS 2015

Part 1 of the post is here: Click here

Part 2 of the series is here: Click here

This is part 3 of the series on new features available with C# 6.0 and Visual Studio 2015. In this post I am going to go through

CodeLens feature on Visual studio 2015.

One of the new cool features with Visual Studio 2015 is Code Maps.

This is not available for Visual studio 2015 community edition.

Here is how to do this:

Just go to the project and Select Show on Code Map:

clip_image002

Below I am giving a run down on the Sample Plugin solution being provided with SDK:

clip_image004

So, what’s the big deal here? Just click expand

clip_image005

And keep expanding to have a great visualization of your code:

clip_image006

Hope it helps and Happy CRMing!