create connections between two entities with Late Binding in Microsoft CRM 2011


I would like to share benefits of connections in Microsoft CRM 2011 and how to build connection in 2 Entities by LateBinding.
Connected entities may be both Custom or System.

here is how the SDK describes the benefits of Connections
Connections provide the following capabilities:
  • An easy and flexible way to make a connection between two records of most Microsoft Dynamics CRM entity types. All customizable business and custom entities can be enabled for connections.
  • An option to add useful information, such as description of the connection and the duration.
  • An ability to create connection roles that describe the relationship between the two records, such as a relationship between a doctor and a patient, or a manager and an employee.
  • A quick way to create multiple connections and roles for a particular record. For example, a contact may have many relationships with other contacts, accounts or contracts. In each relationship a contact may play a different role.
  • Information for building queries and creating graphs. You can search for all connections and connection roles for a particular record and create graphs and charts for visual representation of the connections.
  • Support for workflows and auditing for automating and improving the business processes.
Here is the codes written in C#

                        Connection connectEntities = new Connection {
                            Record1Id = new EntityReference(.EntityLogicalName, .Id),
                            Record1RoleId = new EntityReference(ConnectionRole.EntityLogicalName, new Guid()),
                            Record2Id = new EntityReference(.EntityLogicalName, .Id),
                            Record2RoleId = new EntityReference(ConnectionRole.EntityLogicalName, new Guid()),
                        // Execute with OrganizationServiceProxy.                        // you can get more details about how to initialize  OrganizationServiceProxy from this blog posts.

all the best...


Popular posts from this blog

Assembly Microsoft.Dynamics.Service.Plugins.dll can not be loaded. Dynamics CRM 365 Engine version 9 - CRM User creation error

Exception caught instantiating TERADATA report server extension SQL Reporting Services

Could not load file or assembly 'System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified at Configuration class initiation in