When you have a subgrid in CRM, you will notice there is an “Add New” and an “Add Existing” button. But the question is: Why sometimes only one of the two buttons is visible while some others both are visible?
The answer is actually not very straight forward and it depends on multiple factors:
1. Is it a 1:N or N:N relationship?
This determines the display rules of the given buttons.
2. On which entity?
Some out of the box entities have different display rules than others.
3. Is it the sub-grid of a custom entity?
Custom entities should all have the same display rules.
4. Is the parent lookup a required field in the child records?
This affects the visibility of these buttons. For example, if you have an 1:N relationship between Airports and Terminals then the visibility of the “Add Existing” button for the Terminals sub-grid on the Airport form depends on whether “Airport” is a required field for the Terminal or not.
This table summarizes the availability of the “Add New” and “Add Existing” buttons:
|Relationship Type||Is the parent required on the child (lookup field is marked as required)||“Add New” button visible?||“Add Existing” button visible?|
When you look at the sub-grid ribbon you might find that there are two “Add Existing” buttons defined (this is true for most system entities and all custom entities): “Add Existing Standard” and “Add Existing Associated”:
So what’s the difference? It is misleading to believe that “Standard” is the button shown when there is an actual sub-grid inserted in the main form and “Associated” is the one visible in the associated view when using the form navigation (associated view) instead of a sub-grid. In fact, that’s not it at all. The actual difference is that “Standard” is the button that applies to 1:N relationships and “Associated” is the button that applies to N:N relationships. Therefore, depending on the type of relationship for your entity you will need to modify one button or the other. Note that some entities (e.g. contact) do not have an “Add Existing Standard” button so by default the “Add Existing” button is only available to N:N relationships.
To make your life simpler, I suggest using the visual ribbon editor which will show you all the buttons available in all entities as well as the display rules that apply.