Share via

Connection entities


Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

The connections provide a flexible way to connect and describe the relationships between any two entity records Microsoft Dynamics 365. It helps you to promote teamwork, collaboration, and effective management of business and sales processes. Connections enable you to easily associate users, contacts, quotes, sales orders, and many other entity records with each other. The records in the association can be assigned particular roles that help define the purpose of the relationship.

Connections provide the following capabilities:

  • An easy and flexible way to make a connection between two records of most Microsoft Dynamics 365 entity types. All customizable business and custom entities can be enabled for connections.

  • An option to add useful information, such as a description of the connection and the duration.

  • The ability to create connection roles that describe the relationship between 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 business processes.

Enabling and creating connections

You can enable any custom or customizable entity for connection by updating the entity metadata. Use the UpdateEntityRequest message to set the IsConnectionsEnabled property to true.

To create a connection between two records, use the Connection entity. You must specify a record from which you create a connection (source) and a record to which you connect (target). Use the Connection.Record1Id attribute to specify the source entity record and the Connection.Record2Id attribute to specify the target entity record. Optionally, you can specify the duration of the connection and the description. To describe the relationship between the participants in the connection, use the connection roles. To specify the connection roles, use the Connection.Record1RoleId attribute and the Connection.Record2RoleId attribute.

Querying connections

Querying connections gives you valuable data that you can use to create reports, graphs, or charts. You can query connections by an entity record, by an entity type (Entity Type Code), by a particular role, or other criteria. The following are examples of how you can query connections:

By an entity record:

  • Show all connections for account A.

  • Show all roles for account A.

By an entity type (using Entity Type Codes):

  • Show all roles for the competitor entity.

  • Find the total number of roles for the account entity.

By a role:

  • Find all connections where account A is a “Vendor”.

  • Find all open opportunities over $20,000, where contact B is a “Salesperson”.

  • Find all matching roles for a “Doctor” role, such as “Patient”, “Nurse”, or “Medical Assistant”.

  • Find all contacts that have the role “Friend”.


When you create a connection entity record, two records are created in the database. The first record represents a source to target connection and the second record represents a target to source connection. This guarantees that a query will find all connections that the record participates in, regardless whether the record is a source record or a target record in the connection.

See Also

Describe a relationship between entities with connection roles
Connection entity messages and methods
ConnectionRole entity messages and methods
ConnectionRoleObjectTypeCode entity messages and methods
Sample code for connection entities
Business management entities
Customize visualizations and dashboards
Fiscal calendar and territory entities

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright