Wednesday, January 23, 2013

Object doesn't support property or method in CRM 2011 Javascript after Rollup 12 or Dynamics CRM December 2012 Service Update

Today a Customer reported an error on a CRM 2011 Online solution. In this solution we were using a grid which is filtered through grid.control.setParameter("fetchXml", fetchXml);. This was not working anymore after the Dynamics CRM December 2012 Service Update.

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.

No comments:

Post a Comment