{SCRIPTING TIP} Refresh CRM form asynchronously when records are changed in Sub-grid in CRM 2015 Update 1

Sometimes I have had the requirement in past to refresh CRM form when things are being added to the record sub-grid. I wasn’t able to achieve a solution in supported scripting prior to CRM 2015 Update 1.

Here is the piece of code which needs to be added to your Form on load which will take care of refreshing the form asynchronously every time anything is added to the subgrid

function onload() {

var gridOnloadFunction = function () { Xrm.Page.data.refresh(false); };

Xrm.Page.getControl(“Subgridname”).addOnLoad(gridOnloadFunction);

}

 

 

Advertisements

4 thoughts on “{SCRIPTING TIP} Refresh CRM form asynchronously when records are changed in Sub-grid in CRM 2015 Update 1

  1. Hi Deepesh,

    Thanks for sharing . I am trying to implement same functionality to refresh account form when associated address is modified.

    I wrote same code on account load but this is not refreshing required field on the account form . I am using CRM 2015 (version 7.0.1.129) IFD and using IE 11.

    Please can you help me on this.

    Regards,
    Vishnu

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s