Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

Remove Subgrid Records Without Deletion Using Ribbon Workbench

Haseeb Ahmad Profile Picture Haseeb Ahmad

Introduction

When building model-driven apps in Dynamics 365 or Power Apps, subgrids play a key role in visualizing and managing related data. A subgrid is a control added to a form that displays a list of related records—for example, listing all assets linked to a project. This helps users see and manage relational data from one central place.

However, a common challenge arises:
How do you allow users to remove a record from the subgrid (i.e., unlink it from the parent) without deleting the record from the database?
By default, the Remove button in a subgrid deletes the relationship. But in tightly integrated systems, we often want to preserve the child record for future use or auditing, even if it’s no longer associated with the parent.

In this post, I’ll show you how to configure the Remove button to only unlink records from the subgrid using Ribbon Workbench, without deleting the actual data from the related table.

Scenario Overview

  • You have two custom tables:

    Project (Parent)
    Asset Management (Child)
      Asset Management has a lookup to Project, forming a One-to-Many relationship.
              On the Project form, there's a subgrid showing related Asset Management records.
              You want to unlink an Asset Management record from the Project (via the subgrid) without deleting the asset itself.

🧰 Tools Used

🛠️ Step-by-Step Guide

1. Open XrmToolBox and Install Ribbon Workbench

  • Launch XrmToolBox.

  • Search for Ribbon Workbench and install it.


2. Create and Prepare Your Solution

  • Go to the Power Apps Maker Portal.

  • Create a new unmanaged solution.

  • Add only the Asset Management table (do not include metadata or other tables).

3. Load the Solution in Ribbon Workbench

  • Open Ribbon Workbench from XrmToolBox.

  • Load the solution you just created.

4. Select the Subgrid and the Remove Button

  • In the ribbon editor, locate the subgrid for Asset Management on the Project entity.

  • Click on the Remove button.


5. Set the RelationshipTypeRule

  • Add a new Display Rule of type RelationshipTypeRule.

  • Set the following values:

    • AppliesTo: SelectedEntity

    • RelationshipType: OneToMany

    • AllowCustomRelationship: True

    • AllowSystemRelationship: True

    • InvertResult: Leave unchecked unless logic needs reversing

6. Check the Relationship

  • Make sure the relationship between Project and Asset Management is indeed One-to-Many.

  • The Asset Management table should have a lookup to Project.

You can verify this in the table relationships in the Power Apps Maker Portal.

7. Publish Your Changes

  • After configuring the Display Rule and Command, click Publish.

  • Wait for the operation to complete. This may take a few minutes.



8. Test Your Changes

  • Go to the Project form in Dynamics.

  • Try removing a record from the Asset Management subgrid.

  • The record should be unlinked, but not deleted from the Asset Management table.

✅ Outcome

You’ve now successfully configured the Remove button to only break the relationship (remove from subgrid), preserving the original data in the child table. This is ideal for scenarios where records should remain in the system but not be linked to a specific parent record.

    💬 Drop a Message & Stay Connected

    I hope you found this guide helpful in managing subgrid relationships more effectively in your model-driven apps. If you have any questions, feedback, or tips of your own, feel free to drop a message in the comments—I'd love to hear from you!

    Thanks for reading, and happy customizing! 🙌

    — Haseeb Ahmad

    Junior Technical Consultant, Beta MLSA









    Comments