Photo of the Chrome 38 bug Knowledge Base article

Patch for Chrome 38 lookup error in Dynamics CRM 2013

With huge thanks to Guido Preite’s blog post on the problem, I have developed a patch for this problem, and I thought I would share.

The crux of the problem is that the code is trying to access an element of an array, and Chrome 38’s JavaScript implementation provides this element already as a feature of the base language. The fix is to simply use the ‘hasOwnProperty’ method to check to see if the array element we are checking actually belongs the object, or is inherited from the prototype.

Here is the fixed function (fix highlighted in red):

function pushCommandParameter(oParameter) {
    if (aParameters.hasOwnProperty(oParameter.Name) && !IsNull(aParameters[oParameter.Name]))
        aParameters[aParameters[oParameter.Name]] = oParameter;
    else {
        aParameters[oParameter.Name] = aParameters.length;
        aParameters.push(oParameter)
    }
}

Unfortunately this is a private method within another function, so we have to redefine the whole thing. I’ve wrapped this up into a simple JavaScript file which you can include on any form that is affected. If and when Microsoft eventually patch the bug, you can simply remove this file from your form.

You can download the patch script here.

7 comments

Leave a Reply