Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 4

Designing Dataverse Data Models

Recommended resources

Hello! Welcome back to your PL-400 certification journey.

In our last lesson, we focused on securing the "container" for our data by designing a robust security model for multi-tenant scenarios using environments, business units, and security roles. Now that we know how to protect our data at an architectural level, it's time to design the data structure itself.

Today’s learning outcome is to design a Dataverse data model, selecting appropriate relationship types and behaviors to enforce business logic and optimize performance. A well-designed data model is the foundation of any scalable and maintainable application. Given your background in computer science and extensive experience with Dynamics 365, you'll recognize many of these concepts, but our focus will be on the specific trade-offs and advanced patterns relevant to the PL-400 exam and modern Power Platform development.

1. Principles of Dataverse Data Modeling

At its core, data modeling is about translating business requirements into a logical structure of tables and columns. A common challenge is striking the right balance between normalization (reducing data redundancy) and performance.

A great starting point is learning to identify when data should be split into separate tables.

Dataverse - ULTIMATE Data Models Guide | Dynamics 365 | ERD

The video 'Dataverse - ULTIMATE Data Models Guide' from Sean Astrakhan provides a practical look at these fundamental principles. We'll start with the first part, which addresses a key signal for creating new tables.

Watch the first two minutes of the video (00:00 - 01:57). Pay attention to the concept of 'repeating data' as a red flag and the problem it creates for data maintenance.

The key takeaway is that repeating text values in a column is a strong indicator that you should create a separate lookup table. This avoids data entry errors and makes updates significantly easier—a core principle of database normalization.

However, it's possible to take normalization too far, which can harm performance. The goal is a pragmatic design that balances data integrity and query speed.

Dataverse Deep Dive: Designing Scalable Data Models

The article 'Dataverse Deep Dive: Designing Scalable Data Models' highlights common performance pitfalls. Let's look at what it says about table design.

Please read the sections titled 'Anti-patterns → Better patterns' (focus on points 1 'Table bloat' and 2 'Over-normalization') and the un-titled section that begins with 'Ever wonder why a table with only a few thousand rows feels slower...'. These sections explain how poor table design can degrade performance.

As the article points out, performance issues in Dataverse are often caused by schema design, not data volume. Two key anti-patterns to avoid are:

  • Table Bloat: Creating tables with hundreds of columns "just in case." This increases the load on forms, views, and database operations. It's better to move rarely used fields to a related "details" table.
  • Over-Normalization: Splitting out attributes that change infrequently. If you're constantly joining to another table just to get a simple label that rarely changes, you might be paying a performance penalty for no real benefit. Sometimes, denormalizing (copying) that stable data back into the main table is a better choice.

2. Choosing the Right Relationship Type

Once you have your tables, you need to connect them. Your Dynamics 365 experience makes you an expert in relationships, but for the PL-400, it's crucial to understand the trade-offs between different ways of implementing Many-to-Many (N:N) relationships.

One-to-Many (1:N) and Multi-Select Choices

The most common relationship is One-to-Many (1:N), where one record in a parent table can be related to many records in a child table (e.g., one Account has many Contacts). For simple, static lists of options, you can also use Choice or Multi-Select Choice columns as an alternative to a lookup table.

Let's see a practical demonstration of creating a 1:N relationship and a brief discussion on using choices instead.

Dataverse - ULTIMATE Data Models Guide | Dynamics 365 | ERD

Continuing with the 'ULTIMATE Data Models Guide' video, the next segment demonstrates creating a 1:N lookup relationship and then introduces choices as an alternative.

Please watch from 01:57 to 04:19 to see the creation of a 1:N relationship. Then, skip ahead and watch from 16:16 to 16:52 for a quick look at using Choice columns.

Many-to-Many (N:N): OOTB vs. Custom Intersect Table

This is where design decisions become critical. A Many-to-Many (N:N) relationship allows many records of one table to be related to many records of another (e.g., a student can enroll in many courses, and a course can have many students). Dataverse offers two ways to achieve this.

  1. Out-of-the-Box (OOTB) N:N Relationship: You create this directly in the maker portal. Dataverse automatically creates a hidden "intersect" table in the background to manage the links. This is quick and easy, but has significant limitations.
  2. Custom Intersect Table (Manual N:N): You create your own table (e.g., "Enrollment") that has a 1:N lookup to each of the two primary tables (e.g., "Student" and "Course"). This approach requires more setup but offers maximum flexibility.

The following video explains this crucial difference and its implications in detail.

Dataverse - ULTIMATE Data Models Guide | Dynamics 365 | ERD

This is the most important segment of the 'ULTIMATE Data Models Guide' video for our lesson. It demonstrates both N:N patterns and clearly explains their pros and cons.

Please watch from 04:19 to 16:16. This section covers the OOTB N:N relationship, reveals the hidden intersect table and its limitations, and then shows how to build a custom intersect table to overcome those limitations. Finally, watch the summary from 16:52 to 17:54.

The video covers a lot, so let's summarize the key limitations of the OOTB N:N relationship, which are often the deciding factor.

Many to Many Relationship Limitations in Power Platform
This image summarizes the five main limitations of the hidden intersect table created by an out-of-the-box N:N relationship, including the inability to add custom columns or trigger Power Automate flows directly.

Here’s a summary to guide your decision:

Feature OOTB N:N Relationship Custom Intersect Table
Setup Fast and simple in the maker portal. Requires creating a new table and two lookups.
Metadata on Relationship No. Cannot add columns like "Price," "Date," or "Role" to the relationship itself. Yes. You can add any number of columns to your custom table.
Power Automate Trigger No. Cannot trigger a flow when a relationship is added/removed. Requires a plugin workaround. Yes. You can trigger a flow on the create/update/delete of a record in your custom table.
User Experience Simpler UI (Add Existing button). Fewer clicks for users. Requires creating a new record (+ New button), which opens a form. More clicks.
Data Import No. Cannot directly import relationships from Excel/CSV. Yes. You can import data directly into your custom table.

Guideline: Use the OOTB N:N relationship for simple "tagging" scenarios where you don't need metadata or automation. For almost all other business scenarios, a custom intersect table is the more robust and scalable choice.

Test your understanding!

You are building an application to manage event registrations. You have a Contact table and an Event table. You need to track which contacts are registered for which events. Additionally, for each registration, you must store the registration date and whether the contact paid the registration fee.

Which type of N:N relationship implementation should you choose and why?

Show answer

You should use a custom intersect table, likely named Registration.

Reasoning: The requirement to store metadata on the relationship itself (the Registration Date and Payment Status) makes the OOTB N:N relationship unsuitable. By creating a custom Registration table with lookups to Contact and Event, you can add columns for Registration Date, Payment Status, and any other information specific to that individual registration.


3. Enforcing Business Logic with Relationship Behaviors

Relationship behavior (or cascading rules) defines what happens to related child records when you perform an action (like Delete or Assign) on the parent record. This is a powerful feature for maintaining data integrity but can also be a performance trap if not configured carefully.

This video provides an excellent overview of the three main behavior types.

Dataverse - Relationship behaviors - Parental, Referential & Custom

The video 'Dataverse - Relationship behaviors' from Dhruvin Shah clearly explains and demonstrates the options available for controlling cascading actions.

Watch this video from the beginning to end (00:00 - 08:58). It covers the three main behavior types: Referential, Parental, and the highly flexible Custom option.

Let's recap the types of behavior for a 1:N relationship:

  • Parental: A "cascading" relationship. Actions on the parent record cascade to all child records. For example, deleting the parent automatically deletes all its children. Sharing the parent shares all children. This is the default for some system relationships (e.g., Account to Opportunity), but use it with caution on custom tables.
  • Referential: A "non-cascading" relationship. The records are linked, but actions on the parent do not affect the child. For the Delete action, you have two choices:
    • Remove Link: If you delete the parent, the lookup field on the child records is cleared (set to null). The child records themselves are not deleted.
    • Restrict: Prevents you from deleting the parent record if any child records exist. This is the safest option for data integrity.
  • Custom: This gives you granular control over the cascading behavior for six different actions: Assign, Share, Unshare, Reparent, Delete, and Merge.
Dataverse Cascading Relationship Behaviors (Custom)
This is the interface for configuring custom relationship behaviors, allowing you to define the precise cascading rule for each type of action on the parent record.

For a definitive list of all possible configuration options, you can always refer to the official documentation.

Configure table relationship cascading behavior

The Microsoft Learn article 'Configure table relationship cascading behavior' is the official reference. You don't need to memorize it, but it's good to know where to find the authoritative details.

Quickly scan the table under the section 'The SDK for .NET CascadeConfiguration class...'. It shows which cascade options are valid for each of the six actions. This is a useful reference for a developer.

Performance Consideration:
Aggressive cascading can be a major performance bottleneck. Imagine a parent record with thousands of child records. A single Assign action could trigger thousands of updates in the background.

The "Dataverse Deep Dive" article (LINK) we looked at earlier specifically calls out "Aggressive cascading" as an anti-pattern. The recommended fix is to: "Restrict to None or Remove Link where business rules allow; trigger targeted updates with plugins/flows instead of global cascades." This is a key architectural principle for building scalable applications.


Conclusion

You are now equipped to make informed decisions when designing a Dataverse data model. Your ability to weigh the trade-offs between normalization, relationship types, and cascading behaviors is a hallmark of a senior Power Platform developer.

Key Takeaways:

  • Balance is Key: A good data model balances normalization (to reduce redundancy) with denormalization (to improve query performance). Avoid "table bloat" and "over-normalization."
  • Choose N:N Wisely: Use the OOTB N:N relationship for simple tagging. For any scenario requiring metadata on the relationship or automated triggers, a custom intersect table is the superior, more scalable choice.
  • Control Cascading: Use relationship behaviors (Parental, Referential, Custom) to enforce data integrity. Be mindful that aggressive cascading (Cascade All) can hurt performance, and it's often better to use Restrict or Remove Link and handle complex logic with Power Automate flows or plugins.

In our next lesson, we will continue to build on this foundation by looking at how to implement complex data structures in Dataverse using polymorphic lookups and hierarchical relationships. These are advanced tools that allow you to model even more sophisticated business scenarios.