One of the new features in Dynamics CRM 2011 is sub-grids. The sub-grids can be inserted in entity forms to display the related data. For example, I can have a sub-grid in "Account" entity form to display all the related "Opportunities". In the same way in "Account" form I can have sub-grids to display related "Orders" or related "Quotes" or related "Invoices". The uses of sub-grids make it so easy to attach related entity records.
In Microsoft Dynamics CRM 4.0 the same functionality is achieved by displaying the related entity records within IFrames. In Microsoft Dynamics CRM 2011 we have out of the box sub-grids feature which is simple to configure and use.
In this blog I will show how to insert a sub-grid and display related records.
1) Below is the list of custom entities in my CRM 2011. I will use two of them in my blog to demo this sub-grid feature. These entities are "Genres" and "Sub Genres".
I have an entity called "Movies". This entity contains the records of movies. These movies are categorised by genre and sub genre. Every movie falls under a genre and a sub genre.
Every sub genre has a parent genre. There is a 1:N relationship between genre and sub genre. In my demo genre record will display related sub genres in a sub-grid.
|Genres and Sub Genres|
2) Below is the list of all active genre records.
3) Below is the list of all active sub genre records. As seen and marked below, each sub genre has a related genre. In other words every genre has multiple related sub genres.
|Sub Genre Records|
4) I will customize the "Genre" entity form to add a sub-grid. To do this I will go to genres and click on "Customize Entity" button.
|Customize the "Genre" Entity Form|
5) This will open the genre form in edit or design mode. Highlight the section where you want to add the sub-grid. As I want the sub grid in "General" tab and after "Genre" section, so I will select the "General" tab. I will click on "Sub-Grid" button on the "Insert" ribbon. This will open a "List or Chart Properties" window.
|Add a Sub-Grid to "Genre" Entity Form|
6) I will fill in the required details in the "List or Chart Properties" window. This will set the properties for the sub-grid.
I will give it a unique name of "SubGenre". I will give it a label of "Sub Genres".
The important section which configures the sub-grid's display can be set in "Data Source". Select "Only Related Records" for Records. This will only show related records for the genre record. In the "Entity" field select the option "Sub Genres (Movie Genre)". This is what gets displayed in the sub-grid. Since we have selected the option of "Sub Genres (Movie Genre)", which means sub-grid will only display sub genres for the genre record.
7) Below are the final settings for "Data Source" section in "List or Chart Properties" window. Click "OK" button.
|Sub-Grid's Data Source Settings|
8) The sub-grid is inserted in my genre form. It is inserted in the "General" tab. Now I save my changes and test the output.
|Sub-Grid Added to "Genre" Entity Form|
9) I will save and publish my changes so that I can view the sub-grid on the genre form.
|Save and Publish the "Genre" Entity Form|
10) I will test this sub-grid feature. I will go to the genres and open the first genre "Family". As seen below the sub-grid in "Family" genre form shows all the sub genres. These sub genres are the ones which are related to the genre "Family".
|Genre "Family" and its Sub-Grid showing related Sub Genres|
I will close the "Family" genre record and open the "Non Mainstream" genre record. As seen below the sub-grid in "Non Mainstream" genre form will display only sub genres related to it.
|Genre "Non Mainstream" and its Sub-Grid showing related Sub Genres|
I hope this blog about 'Microsoft Dynamics CRM 2011 - Form Sub-Grids' was informative. Please feel free to leave your comments.