New Microsoft Dynamics CRM SDK Feature: Grid APIs

New Microsoft Dynamics CRM SDK Feature Grid APIs

Microsoft Dynamics CRM 2016 contains many new Form scripting capabilities. Along with other great features, there is a new and improved CRM Grid API (originally introduced in CRM 2015 Update 1).

Up until now, CRM Grids only supported the ability to be refreshed. In this update you can now interact more with the Grid controls.

Grid APIs are valid for:

  • Form Sub Grids
  • Grid Controls passed as a parameter to a ribbon Rule or Action

Grid API now supports common functions like on load, accessing a grid view’s rows and data, and an API call for switching sub grid views or hiding sub grid view control programmatically. A few common use cases for these API’s are:

  • Access the visible data in a grid, without having a round trip call back to CRM
  • Access the grid, call the refresh and get the total number of records returned, without having a round trip call back to CRM
  • Change grid view programmatically, based on user input

Grid objects provide methods to manipulate the grid and views in the control, as well as accessing the data in the rows of the grid control. You would find calls such as refresh, getGrid, getViewSelector, removeOnLoad and addOnLoad.

Note: addOnLoad events are not available in grids customizations to be pre-configured. Therefore, you would need to run addOnLoad at the run time to add events to the control.

Within the Grid control, you can access the Grid Context, like getTotalRecordCount which will give you the total record count for the sub-grid. Additionally, you can access the Rows and Selected Rows of the Grid. These objects will return visible row data without you having to go back to the server to get this information. For example, on the Account form, you can now access the related Context of the sub-grid. If that grid was to contain four Contacts, including the Names (First Name and Last Name) and Email, all of this data in addition to the GUID of the records will be returned to your code, without any additional round trips to the CRM Server.

Some main Functions available in this update are:

  • OnLoad event
  • getEntityName()
  • gridViewSelector()
    • isVisible()
    • show()/hide()
    • getCurrentView()
    • setCurrentView()
  • getGrid()
    • getRows()
    • getSelectedRows()
    • getTotalRecordCount()


For more information about Microsoft Dynamics CRM, please contact FMT Consultants by filling out the form below.

Written by:
Muhammad Zeshan, Senior Microsoft Dynamics CRM Consultant
FMT Consultants

 FMT Consultants
Privacy Policy

Contact Us


Newsletter Sign-up

menu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram