Archive
Sub Grid Refresh Event – CRM 2011
Hi,
Sometimes we may need to refresh Parent form, when we Add/Remove records from sub grid (i.e., On Subgrid Refresh). We can achieve this with below steps
- Get the “subgrid” id (i.e., Name of the subgrid, we can get it from either ‘Form customization’ or using IE Developer Tool)
- In parent form, onload() function attach ‘onrefresh’ event to “Subgrid”
function Form_onload() {
//Set Action on subgrid Refresh
var subGrid = document.getElementById(“{Subgrid ID}“);
if (subGrid) {
subGrid.attachEvent(“onrefresh“,fnGridRefresh);}
}
//This function fires on subgrid refresh
function fnGridRefresh(){
alert(“Grid refreshed!!!!”);
}
Hope it helps 🙂
Disabling form in CRM 2011
Hi,
Here is the Jscript code to disable the CRM Form (i.e., Fields on the form)
function doesControlHaveAttribute(control){
var controlType = control.getControlType();
return controlType != “iframe” && controlType != “webresource” && controlType != “subgrid”;
}
function disableFormFields(truefalse){
Xrm.Page.ui.controls.forEach(function(control, index) {
if (doesControlHaveAttribute(control)){
control.setDisabled(truefalse);
}
});
}
How do I call this?
- To disable Form – disableFormFields(true)
- To Enable Form – disableFormFields(false)
Hope it Helps 🙂