Dynamics Quick Tip

There are three different types of relationships within Microsoft Dynamics 365/CRM: 1-to-many (1:N) relationships, many-to-1 (N:1) relationships, and many-to-many (N:N) relationships.

1-to-many, or 1:N relationships, are used when you are creating a relationship between two entities where there are multiple records from one entity associated with a single record from another entity.

In layman’s terms, this means when you have a parent (or primary) entity and many related (or child) entities.

The classic example of a 1-to-many (1:N) relationship is between Account (1) and Contact (N).  You can have one Account with many Contacts who are associated with it.

By default, each Contact record has a lookup field back to an Account record.  So, each Contact can be set to one Account record.  Then, when looking at an Account record, by default there is a sub-grid of the many Contacts that are related back to the Account.

Common 1:N relationships are:

  • Accounts to:
    • Contacts
    • Opportunities
    • Cases
    • Activities
    • Quotes
    • Notes

Now, 1:N relationships can also be applied to custom entities. A common example we see is around managing Projects and their related items within D365.

A custom entity called Project (1) is created and then another entity called Project Items is created (N).

A 1:N Relationship is built between Project and Project Items so a User can manage all the items associated to a Project.

The many-to-one (N:1) relationship is just a looking at the N:1 relationship in reverse. So, in going back to our Account to Contact 1:N relationship example, the N:1 relationship is Contact to Account.

When looking at the relationships under an entity, looking at the 1:N listing will show you all the entities that are classified as parents.

If you look at the N:1 listing, it will show you all the entities that are classified as children. Now you will see entities (like Accounts) that are in both listings, this just means they are a parent to some entities and children to others – this is more advanced and could be a future topic if requested.

To create or edit a 1:N relationship between entities, follow these steps:

  1. Open solution explorer
  2. Under Components, click on “Entities”, then expand the Entity you want to work with
  3. Select 1:N Relationships
  4. If you want to edit an existing Relationship, click on the relationship, then on the Actions toolbar. To edit, select “More Actions”, then “Edit”. To add a new relationship, click on “New 1-to Many Relationship”.
  5. For new relationships, you will want to select the related entity. To do this, navigate to the Relationship Definition section, and choose from the Related Entity list to select which you’d like to be related to your new relationship.
  6. Choose whether or not you want this to be searchable before continuing on.
  7. Define a value for the “Display Name” field in the “Lookup FIeld” section.
  8. Specify data requirements for the field before you save by selecting an option in the Field Requirements list.
  9. Choose an option for displaying associated views or a custom label via the Navigation Pane Item for Primary Entity section, and using the Display Option list.
  10. In the “Relationship Behavior” section, choose from the following options in the “Type of Behavior” list:
    • Parental
    • Referential
    • Referential, Restrict Delete
    • Configurable Cascading
      (Note: Learn more about these behaviors by watching the user group webinar referenced below.)
  11. Click “Save and Close” once you’re done to close out the Relationship form.
  12. When you’ve completed your customizations, publish them.

Learn more about 1:N Relationships when you replay Ledgeview’s Dec. 2018 Microsoft Dynamics 365/CRM User Group Webinar, “Best Practices for the Advanced Admin”.

Want more technical tips and insight like this from the experts at Ledgeview? Sign up for the next user group webinar here.

Microsoft Dynamics 365 CRM User Group Webinar

Contact Us Today

To learn more about Ledgeview’s Expertise

Related Articles