Working with Dynamic entities is a bit different in 4.0 vs. 3.0.  When writing plug-ins and using Microsoft.Crm.Sdk, you have the ability to access the attributes of a Dynamic Entity via a property bag, much like this:

DynamicEntity updateEntity = new DynamicEntity("m3_roundrobin");
updateEntity["m3_lastuserid"] = newOwner.ToString();
updateEntity["m3_teamid"] = teamId.ToString();

However, if you're writing an application that used the standard CRM web service, this methodology is not available to you, so you have to resort to the more code-intensive methods we used in CRM 3.0

Fortunately, if you look deep into the CRM SDK, you'll find a solution to this issue.

After installing the CRM 4.0 SDK, browse to this folder:

sdkserverhelperscscrmhelpers

and look for the following file:

dynamicentitypartialtype.cs

If you add this file to your Visual Studio project, you will have the same Dynamic Entity property bag capability using the CRM web service as you do when using the Microsoft.Crm.Sdk assembly.

I was pleasantly surprised when I located the code and it has made working with Dynamic Entities much easier.

 

Have a great weekend everyone.

 

3 Responses to Working with Dynamic Entities in CRM 4.0

  1. [...] Working with Dynamic Entities in CRM 4.0 Mitch Milam's Microsoft Discussions wrote this [...]

  2. redware says:

    Thanks – nice one. I have just converted all our routines to CRM 4.0 and this caught me out.

  3. [...] 0 von Mitch MilamURL: http://blogs.infinite-x.net/ Inhalte:Working with Dynamic Entities in CRM 4.0CRM Accelerators AnnouncedSQL 2005 error message of the day [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>