web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Remove Records from OneToMany Subgrid

(0) ShareShare
ReportReport
Posted on by 8

Hello!

We are using the Lead entity and have a OneToMany relationship from it to the Opportunity entity. However, we don't actually consider the Leads "parents" of Opportunities because we do not create Opportunities from Leads; Opportunities are created in our own in-house system and then interfaced into Dynamics CRM. To associate the records together, we have a subgrid on the Lead form to show related Opportunities, and then just use the "Add Existing" button on the subgrid to link one Lead to many Opportunities.

Once that relationship is created using the "Add Existing" button, a user can then NOT "Remove" the record because there is no Remove button on the subgrid. From my research, that appears to be intentional functionality due to it being a OneToMany relationship--Microsoft's logic being "this is a parent-child relationship, you can't have a child without a parent." Which is valid, but doesn't encompass our particular logic (which I argue is just as valid--from a business standpoint, it IS OneToMany because we do NOT allow an Opportunity to have multiple Leads, regardless of how the Opportunity was created).

Opportunities are NOT writeable because they come from our in-house system, which is considered the authoritative system. They cannot be edited in Dynamics CRM.

So if a user creates a relationship from a Lead to an erroneous Opportunity, they have no way of deleting that relationship ("Remove record"), because there is no "Remove" button on the subgrid, and they can't go to the Opportunity and remove the lookup on that form.

I know the javascript I have to write to get around this, that's not my question. What I want to know is, simply, this:

Is it possible to modify the Remove button in the Ribbon Workbench to show on OneToMany subgrids, using only OOB functionality/javascript/customization, and WITHOUT changing the relationship to ManyToMany?

If the answer is straight up "Nope, not possible, you have to write your own javascript or change it to N:N," then I'll do that. If the answer is "Yeah you can do it, but with a bit of tweaking or you need to set security properly," I would love to learn how.

   (This one looks a LOT like my exact scenario but there was no follow up that really helped.)

   (The question is not quite what I'm asking, but the answers seem to suggest this IS possible? But I cannot get it to work using this method.)

I have made sure that the security role I'm using for this has Append To rights for the Opportunity entity, and Append rights for the Lead entity.

Thank you!

RemoveButton.png7380.Command.png5554.DisplayRule.pngLeadSubgrid.png

I have the same question (0)
  • Suggested answer
    PThompson Profile Picture
    8 on at

    I found my answer.

    It IS possible with OOB functionality that you just have to tweak. I had two issues:

    1) I was modifying the Lead subgrid ribbon when I should have been modifying the Opportunity ribbon!

    2) I didn't have the OrRule set to Default: True!

    That did it for me!

    Of course, this means that this subgrid will be like this for ALL forms it's on for N:N and 1:N relationships, but I believe my business wants that anyway. If not, that's where the javascript will come in. I'm just happy to have my answer.

  • Suggested answer
    Haseeb Ahmad Profile Picture
    2 on at
    Hi 
    Yes, it is absolutely possible to modify the Remove button in the Ribbon Workbench to show on One-to-Many subgrids using only out-of-the-box (OOB) functionality and customization, without converting the relationship to Many-to-Many.

    Applying a Display Rule of type RelationshipTypeRule to make the Remove button visible and functional for One-to-Many relationships  / or change the existing relationship from many to many To one to many

    This method does not delete the record from the associated (child) table—it only removes the relationship, effectively unlinking it from the parent record.
    Works great in model-driven apps where subgrid control is based on lookup fields.


    Full Step-by-Step Guide:
    Remove Subgrid Records Without Deleting from Parent or Associated Table

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans