Cascading Rules Configuration
Complete the full lesson to earn 25 points
Work through each section, then tap “Mark as Complete” on the last one.
✦ Skip the page breaks and see fewer ads — read each lesson on a single page with Pro
Cascading Rules Configuration: Managing Data Integrity in Microsoft Dataverse
When you design a database in Microsoft Dataverse, you are not just creating tables and columns; you are building a complex web of interconnected information. At the heart of these connections are relationships, specifically the one-to-many (1:N) relationships that define how data flows from a parent record to its children. Cascading rules are the engine behind these relationships, determining what happens to related records when an action is performed on a primary record. Understanding these rules is fundamental to maintaining data integrity, ensuring security compliance, and providing a logical user experience.
In this lesson, we will explore the mechanics of cascading rules in Dataverse. We will look at why these rules exist, how they function under the hood, and how you can configure them to meet specific business requirements. Whether you are building a simple contact management system or a complex enterprise resource planning tool, mastering cascading behavior is essential for any Dataverse architect or developer.
The Logic of Relationships
In Dataverse, a 1:N relationship exists when one record in a table (the parent) is linked to multiple records in another table (the child). For example, a single "Account" (parent) might have many "Contacts" (children) associated with it. When you perform an action on the Account record—such as assigning it to a new owner or deleting it—Dataverse needs to know what to do with all those associated Contacts. Should they also be reassigned? Should they be deleted? Should they remain exactly as they are?
Cascading rules provide the answers to these questions. Without them, you would have to manually update every related record every time a change occurred at the parent level. This would not only be incredibly tedious for users but would also lead to "orphaned" records—data that is no longer correctly linked or owned, creating significant reporting and security issues.
Parent and Child Dynamics
To configure cascading rules correctly, you must first identify which table is the parent and which is the child. In a 1:N relationship, the table on the "one" side is the parent, and the table on the "many" side is the child. The child table contains a lookup column that points back to the parent table. It is this lookup column that establishes the link and allows cascading rules to trigger.
It is important to note that cascading rules are defined on the relationship itself, not on the individual tables. When you edit a relationship in the Power Apps Maker Portal, you are defining the "behavior" of that relationship. This behavior is what dictates the cascading logic for specific operations.
Callout: Relationship Behaviors vs. Cascading Rules While we often use these terms interchangeably, it is helpful to distinguish them. "Relationship Behavior" is the high-level setting (like Parental, Referential, or Custom) that you select. "Cascading Rules" are the specific instructions for individual actions (Assign, Delete, Share, etc.) that make up that behavior. When you choose a "Parental" behavior, Dataverse automatically configures all cascading rules to "Cascade All."
The Six Cascading Actions
Dataverse allows you to configure cascading behavior for six specific actions. Understanding each of these is critical because they impact different parts of the system, from security to data retention.
1. Assign
The Assign action occurs when the owner of a record is changed. If you have an Account owned by "Sales Rep A" and you reassign it to "Sales Rep B," the cascading Assign rule determines if the related Contacts, Tasks, or Opportunities should also be reassigned to "Sales Rep B." This is vital for ensuring that the person responsible for a client also has ownership of all the supporting documentation and interaction history.
2. Delete
The Delete action is perhaps the most impactful. It determines what happens to child records when the parent is deleted. If you delete an Account, do you want all its related Cases to be deleted as well? In some scenarios, like a temporary lead, this might be fine. In others, like a long-term customer account, deleting the history would be a catastrophic loss of data.
3. Reparent
Reparenting occurs when the value of a lookup field on a child record is changed. For example, if a Contact is moved from "Account A" to "Account B," the Reparent action is triggered. This is specifically relevant for how sharing and security permissions are inherited from the parent record.
4. Share
Sharing in Dataverse allows users to give others access to a record they own. The Share cascading rule determines if, when you share an Account with a colleague, they also get access to all the related records. This is a common way to facilitate collaboration on a specific project or client without granting global access to the entire table.
5. Unshare
Naturally, if you can cascade a share, you must be able to cascade an unshare. If you remove a colleague's access to a parent Account, the Unshare rule determines if their access to the related child records should also be revoked. This ensures that security remains tight and users don't retain "backdoor" access to data via child records.
6. Merge
Merging occurs when two duplicate records are combined into one. The Merge cascading rule handles what happens to the child records of the "subordinate" record (the one being merged away). Usually, these child records are moved to the "master" record to ensure no data is lost during the cleanup process.
Cascading Rule Types
For each of the actions listed above, you can choose from several types of cascading logic. These types define the "how" of the cascade.
- Cascade All: The action is applied to all related child records. If you assign the parent, every child is assigned, regardless of who currently owns them.
- Cascade Active: The action is only applied to related child records that are in an "Active" state. This is useful if you want to leave old, deactivated records (like closed cases) untouched while updating current work.
- Cascade User-Owned: The action is only applied to related child records that are owned by the same user who owns the parent record. This prevents you from accidentally reassigning records owned by other team members.
- Cascade None: No action is taken on related records. They remain exactly as they were, completely independent of the parent record's change.
- Remove Link: This is specific to the Delete action. Instead of deleting the child records, Dataverse simply clears the lookup field, effectively "unlinking" them from the parent.
- Restrict: This is also specific to the Delete action. It prevents the parent record from being deleted if any related child records exist. This is a safety mechanism to prevent accidental data loss.
Note: Not all cascading types are available for every action. For example, "Restrict" and "Remove Link" are only options for the Delete action. "Cascade Active" and "Cascade User-Owned" are primarily used for Assign, Share, Unshare, and Reparent.
Step-by-Step: Configuring Cascading Rules
Configuring these rules is done through the Power Apps Maker Portal. Follow these steps to customize the behavior of a relationship.
- Navigate to the Table: Log in to the Power Apps Maker Portal, select your environment, and go to Data > Tables.
- Open Relationships: Select the parent table (e.g., Account) and click on the Relationships tab under the Schema section.
- Edit the Relationship: Find the 1:N relationship you want to modify. Click the ellipsis (...) and select Edit, or simply click on the relationship name.
- Expand Advanced Options: In the relationship editor pane, scroll down to the Advanced options section.
- Select Relationship Behavior: You will see a dropdown for "Relationship behavior."
- If you select Parental, all rules are set to "Cascade All" and cannot be changed.
- If you select Referential, all rules are set to "Cascade None" (except Delete, which defaults to "Remove Link").
- If you select Custom, you gain full control over every individual cascading action.
- Configure Custom Actions: If you chose Custom, use the dropdowns for Assign, Delete, Share, Unshare, and Reparent to select the specific cascading logic you require.
- Save the Relationship: Click Done and then click Save Table to apply the changes.
Warning: Changing cascading rules on a system that already contains a large amount of data can trigger massive background updates. For example, changing a Delete rule from "None" to "Cascade All" on a table with millions of records could cause performance issues or timeout errors during the update process.
Performance Considerations and the "Share" Trap
One of the most common pitfalls in Dataverse configuration involves the cascading "Share" action. While it sounds convenient to have child records automatically shared when the parent is shared, this can lead to significant performance degradation.
In Dataverse, sharing information is stored in the PrincipalObjectAccess (POA) table. Every time a record is shared via a cascading rule, a new entry is created in this table for every child record. If you share an Account that has 500 related Contacts, 500 Tasks, and 100 Opportunities, a single "Share" action on the Account results in 1,101 entries in the POA table (1 for the account + 1,100 for the children).
As the POA table grows into the millions of rows, the system must check this table every time a user performs a search or views a list to determine what they have permission to see. This can significantly slow down the entire environment.
Best Practice: Use Access Teams
If you find yourself needing to share records frequently, avoid cascading shares. Instead, use Access Teams. Access Teams allow you to grant access to a record without creating heavy overhead in the POA table for every single child record. Alternatively, consider using a more robust Security Role and Business Unit hierarchy to manage access naturally rather than relying on manual sharing.
Practical Example: The "Support Ticket" Scenario
Let's look at a real-world scenario to see how these rules work in practice. Imagine you are building a Customer Service module. You have a table for Accounts and a table for Support Tickets.
Requirements:
- If an Account is reassigned to a new Account Manager, only the Active Support Tickets should be reassigned. Closed tickets should remain assigned to the person who actually resolved them for reporting accuracy.
- If an Account is deleted, we must ensure no Support Tickets are lost. We should prevent the deletion if tickets exist.
- If an Account Manager shares an Account with a technician, the technician should automatically see all related Support Tickets.
Configuration:
To achieve this, we would set the Relationship Behavior to Custom and configure the following:
- Assign: Cascade Active (Addresses Requirement 1).
- Delete: Restrict (Addresses Requirement 2).
- Share: Cascade All (Addresses Requirement 3).
- Unshare: Cascade All (Ensures security is revoked if the technician is removed).
- Reparent: Cascade None (Changing the account on a ticket shouldn't necessarily change ownership).
This configuration balances the need for automation with the need for data integrity and reporting accuracy.
Using Code to Define Cascading Rules
For developers who are automating environment setup or building custom solutions, you can define these rules using the Dataverse Web API or the Organization Service (C#). This is particularly useful when you need to ensure consistent configuration across multiple environments in a CI/CD pipeline.
In C#, you use the OneToManyRelationshipMetadata class. Within this class, the CascadeConfiguration property allows you to set the behavior for each action.
C# Snippet: Creating a Relationship with Custom Cascading
// Define the cascading configuration
CascadeConfiguration cascadeConfig = new CascadeConfiguration
{
Assign = CascadeType.UserOwned,
Delete = CascadeType.RemoveLink,
Merge = CascadeType.CascadeAll,
Reparent = CascadeType.None,
Share = CascadeType.None,
Unshare = CascadeType.None
};
// Define the relationship metadata
OneToManyRelationshipMetadata relationshipMetadata = new OneToManyRelationshipMetadata
{
ReferencedEntity = "account", // Parent table
ReferencingEntity = "new_supportticket", // Child table
SchemaName = "new_account_supportticket_CustomRel",
CascadeConfiguration = cascadeConfig
};
// Create the relationship request
CreateOneToManyRequest createRequest = new CreateOneToManyRequest
{
Relationship = relationshipMetadata,
Lookup = new LookupAttributeMetadata
{
SchemaName = "new_parentaccountid",
DisplayName = new Label("Parent Account", 1033)
}
};
// Execute the request
_serviceProxy.Execute(createRequest);
Explanation of the Code
In this example, we are programmatically creating a relationship between an Account and a custom Support Ticket table. We explicitly set the Assign behavior to UserOwned, meaning only tickets owned by the person who owns the account will move. We set Delete to RemoveLink, which ensures that if an account is deleted, the tickets remain in the system but their "Parent Account" field is cleared.
Setting Share and Unshare to None is a performance optimization, as discussed earlier. This prevents the POA table from bloating during sharing operations.
Comparison of Relationship Behaviors
When you select a high-level behavior in the UI, Dataverse applies a template of cascading rules. Use the table below as a quick reference for what each standard behavior does.
| Action | Parental | Referential | Referential, Restrict Delete |
|---|---|---|---|
| Assign | Cascade All | Cascade None | Cascade None |
| Delete | Cascade All | Remove Link | Restrict |
| Reparent | Cascade All | Cascade None | Cascade None |
| Share | Cascade All | Cascade None | Cascade None |
| Unshare | Cascade All | Cascade None | Cascade None |
| Merge | Cascade All | Cascade None | Cascade None |
Callout: The "Parental" Trap Be very careful with the "Parental" setting. While it seems like the easiest choice, the "Cascade All" on Delete is permanent. If a user deletes a parent record by mistake, every child, grandchild, and great-grandchild record linked via parental relationships will be permanently deleted. Recovery from this usually requires a full environment restore.
Common Pitfalls and How to Avoid Them
1. Circular Cascading
While Dataverse has built-in protections, it is possible to create complex chains of relationships that cause circular logic. For example, if Table A cascades to Table B, and Table B cascades back to Table A, an "Assign" action could theoretically loop forever. Dataverse will usually stop this after a certain depth, but it can cause significant lag and confusing ownership changes.
- Solution: Always map out your data model on paper or a whiteboard before configuring cascading rules to ensure a clear hierarchy.
2. The "Restrict Delete" Frustration
Using "Restrict Delete" is great for data integrity, but it can frustrate users who are trying to clean up data. They may try to delete a record and receive a generic error message saying "This record cannot be deleted because it is associated with another record."
- Solution: Ensure your users are trained to understand the hierarchy. Better yet, create a "Deactivate" flow instead of allowing users to delete records, which preserves data for auditing.
3. Ignoring "Cascade Active"
Many administrators default to "Cascade All" for the Assign action. However, in long-running business processes, this is often a mistake. If a Sales Rep leaves and you reassign their Accounts to a new rep, you usually don't want the new rep to suddenly own 5,000 closed tasks from three years ago.
- Solution: Use "Cascade Active" for the Assign action in most business scenarios. This keeps the history associated with the original owner while moving the current workload to the new owner.
4. Over-Sharing
As mentioned in the performance section, cascading "Share" is the primary cause of slow performance in many Dataverse environments.
- Solution: Evaluate if the users actually need ownership-level access to child records. Often, providing "Read" access at the Business Unit level via Security Roles is a much more efficient way to grant visibility.
Advanced Logic: Merging Records
The Merge action is unique. When you merge two records, one is designated as the "Master" and the other as the "Subordinate." The subordinate record is deactivated and eventually can be deleted. The cascading Merge rule determines what happens to the subordinate record's children.
If set to Cascade All, all related records (Contacts, Tasks, etc.) that were linked to the subordinate record are updated to point to the master record. This is almost always what you want. If you set this to None, those child records will still point to the now-deactivated subordinate record, making them difficult to find and manage.
Tip: When merging, Dataverse also merges the "actual" data in the columns based on user selection, but the cascading rule specifically handles the relationships of the records that aren't being merged themselves (the children).
Summary of Configuration Options
When you are in the "Custom" behavior mode, keep this quick reference in mind for the available options:
- Assign: All, Active, User-Owned, None.
- Delete: Cascade All, Remove Link, Restrict.
- Reparent: All, Active, User-Owned, None.
- Share: All, Active, User-Owned, None.
- Unshare: All, Active, User-Owned, None.
Note that Merge is often not explicitly configurable in the modern Maker Portal for all tables, but it remains a part of the underlying metadata and can be viewed/edited in the Classic Solution Explorer or via code.
Frequently Asked Questions
Q: Can I change the cascading rules of system relationships? A: It depends. Some system relationships (like Account to Contact) allow some modification, while others are "locked" to maintain system stability. If the options are greyed out in the Maker Portal, it means the relationship behavior is managed by the system and cannot be changed.
Q: Do cascading rules trigger workflows or Power Automate flows? A: Yes. If an Assign action cascades to 100 child records, and you have a flow that triggers "On Update" of those child records, that flow will trigger 100 times. This is another reason to be careful with "Cascade All," as it can trigger a massive number of automated processes simultaneously.
Q: What happens if a user doesn't have permission to the child records? A: If a cascading action (like Assign) triggers, but the user performing the action doesn't have the "Assign" permission on the child table, the entire operation will fail. Dataverse treats the parent and its cascaded actions as a single transaction. If one part fails, the whole thing rolls back.
Q: Does cascading work across different environments? A: No. Cascading rules are strictly internal to a single Dataverse environment and apply only to the tables within that specific database.
Key Takeaways
- Cascading rules automate data maintenance by ensuring that actions performed on parent records (like Account) are appropriately reflected on child records (like Contact).
- The Six Actions are Assign, Delete, Reparent, Share, Unshare, and Merge. Each can be configured independently using the "Custom" behavior setting.
- Delete behavior is critical for data safety. Use "Restrict" to prevent accidental loss of important historical data, and avoid "Cascade All" unless you are certain the child records are temporary or disposable.
- Performance matters with Sharing. Avoid cascading "Share" and "Unshare" actions on tables with high record volumes to prevent the
PrincipalObjectAccesstable from slowing down your system. - Cascade Active is your friend. When reassigning records, using "Cascade Active" ensures that historical data remains untouched while current work is moved to the new owner, preserving the integrity of your reports.
- Permissions are enforced during cascades. If a user doesn't have the right to modify child records, the cascading action on the parent will fail and roll back the entire transaction.
- Map your model first. Before setting up complex cascading rules, visualize your table relationships to avoid circular logic and ensure that your data flows in a way that matches your business processes.
Enjoying the courses?
Everything stays free. Pro shows fewer ads, doubles your daily points limit so you progress twice as fast, and lets you read each lesson on one page.
- ✓ Fewer advertisements
- ✓ 2× daily points limit
- ✓ Distraction-free lessons