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

Hi,

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.
                        _serviceProxy.Create(connectEntities);

all the best...

Comments

Popular posts from this blog

Complex Query in QueryExpression in Microsoft CRM 2011

Exception caught instantiating TERADATA report server extension SQL Reporting Services

Microsoft Power Apps Portal integration with Dynamics 365 CE On-Premise - Step By Step Guide