Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

How to add attachEvent to SubGrid in ms rm 2011

$
0
0

Requirement Details:

I have two subgrids in a form that are interlinked to each other.

So when a new record is added to subgrid A; the items in subgrid B will adjust accordingly.

But  the requirement is subgrid B automatically refreshes when subgrid A changes.

I wrte as below Javascript Code  in Form Load:

function mti_Engagement_Subgrid_Refresh() {
debugger;
//We're using setTimeout() here because subgrids are loaded after $(document) is ready.
setTimeout(KeyPrinicpalSubgrid_OnLoad, 1000);
}


function KeyPrinicpalSubgrid_OnLoad() {
debugger;
var KeyPrinicpalsubgrid = Xrm.Page.ui.controls.get("KeyPrincipalsInvolved");
if (KeyPrinicpalsubgrid == null)
{ return; }
else
{
KeyPrinicpalsubgrid.attachEvent("onrefresh", RefreshOrgSubgrid_OnLoad);
}
}

function RefreshOrgSubgrid_OnLoad() {
debugger;
var Orgsubgrid = Xrm.Page.ui.controls.get("Accounts");
if (Orgsubgrid == null)
{ return; }
else
{
subgridB.refresh();
window.location.reload(true);
}

}

I had this in my form onload event and it sometimes worked and sometimes not.

InForm Load showing error is:"

<Message>Object doesn't support property or method 'attachEvent'</Message>".

Please help me out this.


Viewing all articles
Browse latest Browse all 79901

Trending Articles