Sections in this category

How to Create an Entity and Establish a Relationship

What is an entity and why are they created?

An entity can be described as a type of data, or a table of data, with a set of attributes. An entity stores all records grouped under that specific data type. Some common entities you may see when working in Dynamics 365 may be: Contact, Account, Lead, or Opportunity.

Now, creating new entities is a commonplace practice when it comes to customizing a CRM solution. Organizations have different functions and needs, and thus, will have different entities in their solutions, based on how the organization wants to manage their data. For example, an organization may primarily be interested in managing their organization's memberships. They may have set up an entity to manage memberships, another to manage membership applications, another to manage membership payments. This article will show you how to create new entities, as well as establish relationships between entities.

Why are relationships established?

Entities have relationships because although the entities themselves may be representing different components, oftentimes, these components are dynamic, and interact with each other as part of a larger process. For example, although memberships and membership applications are entities which hold different data, the membership process involves each, and each membership must follow a related membership application. So, a relationship should be established between the two.

What types of relationships exist?

There are three types of relationships that exist between entities. When establishing a relationship, the entities will typically have a relationship of either 1:N, N:1, or N:N (In this context, 'N' means Number).

See the article "Data and Relationships" for more information about entity relationships:

Creating an Entity

1. Navigate to Power Platform.

2. Login with your organization's credentials.

3. Choose an environment to work in, or create an environment.

4. Choose a solution to modify, or create a new solution.

5. Open the Objects of the solution

6. Click Tables

7. Click +New Table

8. Enter information about new entity

- Depending on the kind of entity you are creating, the advanced options may be necessary to adjust. For example, you may want contact records to appear in search results, but you may not want membership records to appear in a search result. It is important to know what configuration is ideal for the specific entity you are creating.

- An entity's primary column refers to what information will be displayed first about the entity. Typically, this will be the name of a record. However, this can be configured.

9. Save the table

Establishing a new Relationship

Relationships between entities can be established multiple ways. One way to establish a relationship is to add columns (fields) to a table (entity), and have them lookup to a record of a different entity (Adding a Contact lookup field to Membership records). This allows for N:1 and 1:N relationships to be established. Another way is to add a subgrid to a form, which allows N:N relationships to be established.

Another way to establish relationships is to do so manually. Follow these steps to manually establish a new relationship.

1. Click into the solution's new table
2. In the Schema tile, click Relationships
3. Click +New Relationship

Many out-of-the-box relationships will already appear in this table. Notice that schema names have been generated to identify the relationship between the new entity and other entities.

4. Indicate which type of relationship will be established

Indicate whether this relationship will be 1:N, N:1, or N:N.

6. Click 'Done'

The relationship will now appear in the table of existing relationships