Sub-grid Add Action Behavior in Dynamics CRM

By | May 13, 2014

Introduction:

Since the new refresh forms, we now see sub grids added on the form by default instead of the left navigation links to see the related records. The + (add) button on the sub-grid however appears to work differently for the Case Sub-grid and the Contacts grid on the Account form.

So when do we get a Lookup to choose from an existing record and when do we get a Quick Create Form to create a new record? This indeed is not a difficult question to answer.

It all depends on the field requirement level of the lookup field in the relationship.

Illustration:

If you are on the Account Entity Form and you want to add a contact for the same account, then when you click on the plus sign (Add) button near the Contact Grid, it will give you a lookup to search for the existing records along with a +New at the bottom to add new records.

Contacts
The lookup represents the Add Existing behavior in the earlier versions of Dynamics CRM. As the Company Name on the Contact Form is not mandatory, we can leave it empty and can later associate it with an account using the Add Existing/Lookup feature on the Contacts Sub-grid.

img2

If you in certain cases like to disable Add Existing feature and always be forced to create a new record to associate with the Account, we only need to make the Company Name mandatory (Refer below, Steps to make the Entity Field Mandatory).

img3

Now, when we try to add a Contact for the Account we will get a Quick Create Form instead of a lookup. The reason is, while entering data for the new contact the company name is mandatory as a result any new Contact that will be created will have a Company Name associated with it.

img4

Steps to make the Field mandatory:

Step 1: Go To Settings -> CUSTOMIZATIONS
Step 2: Select Customize the System
Step 3: Expand Entites by clicking on it
Step 4: Expand Contact and Select Fields
Step 5: Now, on the right hand side you`ll find the name of all the fields
Step 6: Search for parentcustomerid and open it (double click on it)
Step 7: You`ll see a Field Requirement field with Optional Selected

img5

Step 8: Change it to Business Required

img6
Step 9: Save and Close
Step 10: Click Publish All Customizations (Important step)

img7

Conclusion:

The + button behavior depends on the requirement level of the field in the relationship. By manipulating the requirement level you can control the + button behavior.