I was searching the web and finally found the following article:
Obeject does not support the property or method for setParameter method in crm 2011 Javascript
grid.control.setParameter("fetchXml", fetchXml);
This will break the code with the error message "Object doesn't support property or method 'setParameter'"
The solution was very simple:
You have to use SetParameter instead of setParameter:
grid.control.SetParameter("fetchXml", fetchXml);
As you maybe don't know which one will work I did the following:
if (grid.control.setParameter != null && grid.control.setParameter != undefined)
{
//Inject the new fetchXml
grid.control.setParameter("fetchXml", fetchXml);
//Force the subgrid to refresh
grid.control.refresh();
}
else
{
AddDebugMessage("grid.control.setParameter is null or undefined");
if (grid.control.SetParameter != null && grid.control.SetParameter != undefined)
{
//Inject the new fetchXml
grid.control.SetParameter("fetchXml", fetchXml);
//Force the subgrid to refresh
grid.control.refresh();
}
else
{
AddDebugMessage("grid.control.SetParameter is null or undefined");
}
}
By the way AddDebugMessage is my little helper alert message function. It is called if a debug flag is set to true.