Dynamics 365 Editable Grid Events & Methods

 

The much-awaited capability of editing a CRM grid inline is one of the new features in Dynamics 365. Using this functionality improves the productivity of the CRM user by significantly reducing the number of mouse clicks.

 

Editable grid is available as a UI control which can be added to an entity through entity customization. Addition of the editable grid to the desired entity will make all the entity views for that entity inline editable allowing the users to make in-place updates to the values of the grid view columns. The editable grid control also enables a very useful feature to group the records in the view by selected view columns. Using form customizations, this control can also be added to the subgrids on the form enabling them for inline edits.

To interact with the editable grid developers can write scripts which can be executed on the following grid events.

  • OnChange
  • OnRecordSelect
  • OnSave

The following table details out several editable grid methods to access the grid control elements and their values programmatically.

Method

Description Implementation

Grid Methods

getGrid() –  Returns the grid object

–  Contains information about all the grid elements

CRM Editable Grid 1
getRows() –  Returns an enumerable collection of data row of the grid

–  Contains information about the row elements of the grid

–  Returns all the rows displayed on the UI

CRM Editable Grid 2
getSelectedRows() –  Returns an enumerable collection of selected data rows of the grid

–  Returns data related to one or more rows selected on the UI

CRM Editable Grid 3
getTotalRecordCount() –  Returns the count of the number of rows in an entity view  

CRM Editable Grid 4

Grid Row Methods

getData(),

getKey(), getData().getEntity(), getData().getEntity().getEntityName(), getData().getEntity().attributes

–  Returns an object of the row data specific to the record displayed/selected in the grid

–  Contains entity information, attributes information and related entity information

–  Attributes returned are limited to the columns presented in the editable grid

CRM Editable Grid 5

 

Grid Cell Methods

setNotification(),

clearNotification(),

getName(),

getLabel()

–  Each grid cell is associated with a UI control like text, lookup, picklist

–  Information related to these control is available in the attribute collection

–  These controls can be accessed in a similar way as on the entity form

 

CRM Editable Grid 6

 

Hope you find it useful, stay tuned for more updates.

Thank you,
Swaroop Deshmukh
Lead Dynamics CRM Consultant @ Adisys

Advertisements

3 thoughts on “Dynamics 365 Editable Grid Events & Methods

  1. Can you just give examble how to deal with the cell
    rowData.getAttributes().getByName(Work_Order_Fields.F_WORK_ORDER_NUMBER).controls
    returning null
    i tried
    rowData.getAttributes().getByName(Work_Order_Fields.F_WORK_ORDER_NUMBER).getControls()
    also return null

  2. Hi Abood,

    Refer to the Grid Cell methods in the article above.

    To get a cell value you can try this –

    editableGrid.getSelectedRow().getAll()[0].getData().getEntity().attributes.getByName(“attributeName”).controls.getByName(“GridColumnName”);

    This code will give you the value of the cell/column.

    Let me know if this works for you or any further questions.

    Best,
    Swaroop

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s