Adding On Refresh Event to Subgrid CRM 13

Although the latest versions of MS Dynamics CRM allows us to attach functions to specific events of a subgrid, MS Dynamics CRM 13 does not support this functionality using XRM Object Model. Hence, the necessity of a different method is necessary. Find below a code that solves this problem, please keep in mind this is unsupported, but in almost all cases it work as expected:

function AddEventToSubgrid() {
    console.log("Getting subgrid...");
    var Subgrid = document.getElementById('SUBGRID_NAME');

    if (Subgrid == null || Subgrid == "undefined") {
        console.log("Subgrid not found, trying again in 1 sec...");
        setTimeout(AddEventToSubgrid, 1000);

    console.log("Grid Found. Adding on refresh method...");

    console.log("OnRefresh added");


Leave a Reply

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

You are commenting using your 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