Self Referential Many to Many Relationship

I created a Many to Many relationship to and from the User entity- nothing out of the ordinary. I then tried to programmatically retrieve the records associated to this relationship (ie, to the intersect table). I specified the following intersect rule:


LinkEntity filteringLink = new LinkEntity();
filteringLink.LinkFromEntityName = relationshipName;
filteringLink.LinkFromAttributeName = secondaryEntityPK;
filteringLink.LinkToEntityName = secondaryEntityName;
filteringLink.LinkToAttributeName = secondaryEntityPK;
filteringLink.LinkCriteria = filter;

LinkEntity link = new LinkEntity();
link.LinkFromEntityName = primaryEntityName;
link.LinkFromAttributeName = primaryEntityPK;
link.LinkToEntityName = relationshipName;
link.LinkToAttributeName = primaryEntityPK;
link.LinkEntities = new LinkEntity[] { filteringLink };

But I kept getting an error saying: ” ‘geni_followedby’ entity doesn’t contain attribute with Name = ‘systemuserid’.\n Platform\n”.

Looking at the database revealed the obvious issue- because it’s a self referential relationship, both key’s have the same name (systemuserid), so they get renamed to systemuseridone and systemuseridtwo. So I changed my code as follows (quick hack):


LinkEntity filteringLink = new LinkEntity();
filteringLink.LinkFromEntityName = relationshipName;
filteringLink.LinkFromAttributeName = secondaryEntityPK + "two";
filteringLink.LinkToEntityName = secondaryEntityName;
filteringLink.LinkToAttributeName = secondaryEntityPK;
filteringLink.LinkCriteria = filter;

LinkEntity link = new LinkEntity();
link.LinkFromEntityName = primaryEntityName;
link.LinkFromAttributeName = primaryEntityPK;
link.LinkToEntityName = relationshipName;
link.LinkToAttributeName = primaryEntityPK + "one"
link.LinkEntities = new LinkEntity[] { filteringLink };

Microsoft CRM on Amazon EC2

Over the weekend I provisioned a Windows 2003 server on Amazon’s EC2 and installed Microsoft Dynamics CRM 4.0 (plus all the pre-req’s). The idea was to bundle it up as a base image when finished so that I can run up a CRM image for UAT/Test/etc purposes when needed. The installation went fine, in fact, no different to installing Microsoft Dynamics CRM on a ‘normal’ server however, I unfortunately didn’t do enough research before starting and have found out that the D drive isn’t going to be persisted when it’s turned off!! Grrr 😡

As I was installing CRM over the weekend, one of my colleagues was installing TFS 2010 and he has put together a post on his experience- worth a read if you’re planning on doing anything on EC2.

Microsoft CRM V.NEXT

A colleague of mine is at the PDC at the moment and he attended an xRM session yesterday. These are the things he’s fed back from the session:

  • CRM 5 due for RTM around May 2010
  • CRM 5 has rich data federation features for sharing data between instances as well as the upcoming Azure ‘Dallas’ platform
  • CRM 5 includes a plug-in extensibility model for running custom managed code in the cloud hosted environment, ie sandboxed safely
  • Multi-tenanting has been beefed up and is more powerful
  • I’ll post more details as I get them! Meanwhile, here’s a video from last year’s PDC where Humberto Lezama demonstrated a little bit of CRM 5.0. Browse to the 45 minute mark for the CRM 5.0 demo…

    Microsoft CRM SDK updated

    The Microsoft Dynamics CRM 4.0 SDK has been updated and available for download.

    Some of the additions include:

  • Using the Paging Cookie – Fetch and QueryExpression sample code to show you how to implement paging.
  • Using Pre-generated XmlSerializers – use these supplemental assemblies to increase performance.
  • Visualizations (Charts) – This exciting new charts are available for Microsoft Dynamics CRM Online only.
  • Walkthrough: Creating and Registering a Custom Workflow Activity – if you are new to custom workflow activities, this walkthrough will get you started.
  • Authentication with CRM Online – these samples have been updated to get the organization-specific CrmService Web service URL from the discovery service.
  • Using Filters in a Report – new information about enabling data pre-filtering on reports.
  • Stylesheet samples – added HTML, CSS, and image files that provide a starting point for creating Web pages that look similar to Microsoft Dynamics CRM.
  • Import/Export (Customization File) Schema – updated the customization schemas to be used with the latest releases.
  • PluginRegistration tool – includes the latest version of this tool used for plug-ins and custom workflow activities.
  • Choosing Between the WSDL and Assemblies – read this new topic to help you choose the best method for your project