Skip main navigation

Relationship Types 1N

Microsoft Dynamics 365 and the Power Platform

In the previous step, we looked at an overview of relationships. In this step we learn about Relationship Types 1N.

One-to-many (1:N) relationships are the most common type of the relationships found in Common Data Service for Apps. These relationships define how two entities are related to each other. For example, one Account (Employer) can have many Contacts (Employees). Each one-to-many relationship has the following characteristics:

  • One record of a primary entity
  • Zero, one, or many records of a related entity
  • Related entity has a lookup field to store unique identifier of a primary entity

Note: You may see some references to many-to-one (N:1) relationships. These are one-to-many relationships just presented or viewed from the other (many) side. For example, a company that has 1:N relationship to employees is the same as N:1 relationship from employees to the company.

Creating 1:N Relationship

Before you create a custom 1:N entity relationship, evaluate whether using an existing entity relationship, provided by a Common Data Model, would meet your requirements.

There are two designers you can use to create and edit 1:N (one-to-many) or N:1 (many-to-one) relationships:

  • PowerApps portal (Web.powerapps.com): Provides an easy streamlined experience, but some settings may not be available.
  • Classic Solution explorer: Classic experience, provides for more flexibility for less common requirements (discussed later in the lesson). Examples of less common requirements include:
    • Navigation pane options for model-driven app
    • Whether the relationship is hidden in advanced find
    • Field mappings (discussed later in the lesson)
    • Relationship behaviors (discussed later in the lesson)
    • Hierarchical relationship (discussed later in the lesson)

PowerApps Portal

When creating a 1:N or N:1 relationship in PowerApps portal, you can specify information for the following fields:

Field Description
Lookup field display name The localisable text for the lookup field that will be created on the related entity. This can be edited later.
Lookup field name The name for the Lookup field that will be created on the related entity.
Relationship name The name for the relationship that will be created.
Lookup field description The description for the lookup field. In model-driven apps this will appear as a tooltip when people hover their mouse over the field. This can be edited later.

Lookup field name and Relationship name values cannot be changed once the entity is saved. They will be used by report designers and developers, so selecting meaningful and descriptive names could be very helpful. Good name selection also helps to make these fields unique, as the system enforces uniqueness on these values across the environment.

Note: Some system entities can have certain relationship types disabled for them. For example, PowerApps portal does not allow creating many-to-one relationships between Currency and another entity. This type of relationship is disabled because the Currency entity is not customisable and it ism’t possible to add a lookup field to the currency entity as required by this relationship type.

After the relationship has been created, there are some additional properties that you can edit using field editor. Navigate to the entity on the “many” side of the relationship and select the lookup field that was automatically created.

Image showing additional properties availabe

The following additional properties available:

  • Required: Defines whether the lookup must have data before a form in a model-driven app can be saved, e.g. if the contact must have a link to the parent employer company.
  • Searchable: Defines whether this lookup field should be visible within Advanced Find in model-driven apps. Unselect the checkbox if you do not want this field to be available in Advanced Find conditions when working with the entity on N side of the relationship.

Note: Carefully consider if the lookup attribute for a relationship should be a required field. Unnecessarily enforcing it may prevent users from entering data when navigating to the entity directly. For example, making the Employer attribute required will prevent the system from recording contacts that are not employed by a company.

Classic Solution Explorer

Solution explorer provides an alternative to edit 1:N or N:1 entity relationships for Common Data Service for Apps because certain options can only be set using solution explorer. These additional properties are grouped by the sections that follow.

Relationship Definitions

These properties provide additional information about the relationship.

Field Description
Searchable Whether this relationship should be visible within Advanced Find in model-driven apps. Select No if you don’t want the relationship to be available in Advanced Find when working with the conditions for the entity on 1 side of the relationship. Note that visibility of the relationship in Advanced Find is different from visibility of the lookup field discussed earlier.
Hierarchical This option is enabled only for self-referential relationships discussed later in the lesson.

From the primary entity you can navigate to see related records. This data is used by model-driven apps to control how the related entity records are displayed.

  • Field: Display Option – How the related entity list should be displayed:
    • Do not Display. Hides the related entities for this relationship.
    • Use Custom Label. When this option is chosen, the Custom Label field is enabled so that you can specify the localisable text to be used instead of the plural name.
    • Use Plural Name. Use the plural display name defined for the related entity.
  • Field: Custom Label – Specify the localisable text to be used instead of the plural name when you select Use Custom Label as the Display Option.
  • Field: Display Area – Select one of the available groupings to display this list. The available options are: Details (for the Common group), Marketing, Sales, and Service.
  • Field: Display Order – Controls where the navigation item will be included within the selected display area. The range of allowed numbers begins with 10,000. Navigation pane items with a lower value appear above other relationships with a higher value.

Delete Relationships

While viewing entity relationships in PowerApps portal, select the relationship you want to delete. You can use the Delete relationship command from the command bar or from the row context menu when you click the ellipses.

Deleting the relationship will delete the lookup field and the data it contains on the related entity.

Note: You will not be able to delete a relationship that has dependencies. For example, if you have added the lookup field to a form for the related entity, you must remove the field from the form and publish the form before you delete the relationship.

Up next, we uncover another lesson within Relationship – Relationship Types 1N – Special.

This article is from the free online

Dynamics 365: Using Power Platform Applications

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now