A Quick Guide to Connections in Microsoft Dynamics 365

Adam Murchison, 30 October 2017

What are Connections?

Connections are an easy way to connect records without having to create a custom relationship between two entities. A connection can be used between records of the same type or of different types, e.g. a contact can be connected to another contact, or a contact can be connected to an account.

Example of When To Use Connections

You have 3 contacts Bob, Alice and Eve. These 3 contacts are attending an event “Catch-up”, it is commonly thought that placing a lookup field on the event form would be the way to represent this data. When using connections you do not need this lookup, instead you can have connection roles that each contact is associated to. You may have one connection role named ‘Host’ and another called ‘Participants’. Alice is hosting this event so you would establish her connection with the “Catch-up” record as ‘Host’ which can be displayed within a sub-grid on the Event form.

Why Use Connection Roles?

Connections are a great way of connecting multiple entities together regardless of their relationship. A lookup or sub-grid can only be associated with one entity type while connection roles can be related to any entity. Intersecting tables can get very large depending on the amount of data in each entity within many-to-many relationship. Using connections avoids this by creating four records in the connection table, Record1 and Record2 fields which are the primary keys of the connected records and Record1Role and Record2Role fields are the primary keys of the connection roles.
Another reason to use connections is that you can use advanced find to see the connections between records, e.g. you could do an advanced find query to see all ‘Attendees’ of more than one event, or we can look from the opposite side and see all events where a contact fulfils the ‘Attendee’ connection role.

How to Use Connection Roles

First off, a number of Connection Roles come out of the box (can be seen in the image below). You can access this list through Settings->Business Management->Connection Roles and Default Solution -> Connection Roles) and in addition to this you can create custom connection roles.


Creating a Connection Role

When you create your connection role you may want it to be restricted to a single or many entities. This can be achieved in the create connection role screen:

Next click the ‘As this Role’ lookup, for the sake of example I’m going to create a new role. This role is going to be ‘Best Friends’ under the ‘Social’ category, the category is just the type of connection role this falls under, these can be configured under the ‘Category’ option set in the customization section.


Establishing the Connection

Navigate to the record you wish to make a Connection from, and click the ‘Connect’ button within the command bar.

Click the ‘Name’ field in the Connection popup, scroll to the bottom and select ‘Look up more records’ and you’ll see this popup.

Here is the connection form before saving:

Adding a Connection Role Sub-Grid

Okay, so you now have your connection between two records… Success! Now, where do you view this connection you ask? One possibility is to add a new sub-grid to the form you’d like to view the connection on. In this case, I’ll add to the contact form as follows:
Below is the final result of adding the sub-grid and connection. It’s as easy as that.

Reciprocal Roles

I’ve talked about how to connect one record to another in a singular fashion but what about having a reciprocal role that displays a connection on both records? The classic example is having a connection between two contacts, e.g. one record being the Doctor the other connected record being the Patient. We establish this connection by navigating to the connection role that you’d like to match with another connection role and click ‘Add Existing’ on the sub-grid as shown in the below image.
You connect two records in the exact same way, the difference is what is shown on each record when you connect them. Below is what is displayed in the Connection sub-grid for each record and their respective role.

Limitations of Connections

  • There are a few limitations when using Connections:
  • To implement custom logic, you cannot use business rules or BPF’s, instead JavaScript must be implemented.
  • Rollup fields do not work over connections. By this I mean on the connection form you cannot rollup values from related records.
  • I hope this blog quickly summarizes connections for you and I hope you use them in the future!