CRM 2011 – error using Xrm.Utility.OpenEntityForm

I was fixing some code where the code passes a field to a form and then opens it using the excellent Xrm.Utility.openEntityForm

I added a new parameter, parameter_2.  This was going to pass the name of a field I wanted to use

    this.SelectCustomer = function () {

        /// <summary>

        /// Passes customer field values into the customer search screen for a user to create / search

        /// for their workshop entry

        /// </summary>

        var parameters = {};

        parameters[ “paramater_1”] = “name”;

        parameters[ “paramater_2”] = “hosk_searchfield”;

        Xrm.Utility.openEntityForm( “Hosk_Search”, null,  parameters);



I wanted to add one more field but when I added a new field, the form didn’t open and I just got an error.  A generic, which doesn’t tell you anything, I have been getting quite a few of these errors the last couple of weeks

error screen

I tried to debug the javascript onload but it wasn’t even being called.

I took away the new field and it worked.


calm down, be logical, engage brain.

I started with the SDK/documentation, lets see what should happen

lets look at the parameters section
Type: Object

Optional: A dictionary object that passes extra query string parameters to the form. Invalid query string parameters will cause an error. Valid extra query string parameters are:

It turns out the parameters are an optional dictionary object and more importantly

Invalid query parameters will cause an error

So basically when I passed an extra variable but I hadn’t added the variable to the form so it was erroring.


So where do you add these pesky form variables

  • go to the form
  • Form Properties
  • Parameters
Field Form

So I added in the new parameter, saved and published and boom, everything was working, hazaar.


Who thought CRM would have been so picky, ok hands down everyone