D365 – Client Api, Sub-grids & Card Forms

The D365 Client API allows us to access the rows and columns of a sub-grid on a form (see docs for more details). The screenshot below shows an example of the sub-grid and using the Client API we can access the data in those specific columns.

Read-only sub-grid on a form

This is a regular Read-Only grid that is displayed on a normal sized form when viewed on a device large enough to display the content. However, what happens when your device is only large enough to show a more compact view of the data, i.e. in a list view using a Card form.

Card form ‘list view’ of the sub-grid

If the default Card form does not contain the same fields as the normal Read-Only grid then your JavaScript code will not function correctly as it will not be able to access the same ‘cells’ of data in the list view format. To overcome this problem it’s important make sure that the Card form associated to the sub-grid contains the same fields as the Read-Only sub-grid. An important consideration here is that a Card form can only have a limited number of fields so we have to ensure any cells we reference in the Read-Only full size grid are also available to us on the Card form. If you are looking for details about configuring Card forms on sub-grids, there is a good resource here.

BONUS TIP – after making my changes for my Card form and sub-grids I found that my D365 Solution would not import into my TEST environment. Fortunately, I am not alone in experiencing this problem and found my resolution here.