Using Xrm.Utility.openEntityForm with Custom Parameters

Summary of article:

Limitations to the Xrm.Utility.openEntityForm

I recently ran into an issue where I was trying to populate the regarding object on a new Appointment form. I was able to pass the id and name fine, but when I added the regardingobjectidtype parameter I received:

When I checked the error logs I found:

CRM Parameter Filter – Invalid parameter ‘regardingobjectidtype=account’ in Request.QueryString

As it turns out you cannot set the values for partylist or regarding lookups as documented here. It did not surprise me that partylists can not be populated. But I knew the owner and customer fields could, and since they work similarly to the regarding I assumed it would too.

The Work Around

CRM allows you to create your own custom parameters, so you can send additional information into the form that can be picked up by a form script.

Creating the Custom Parameters

1. Open the Form Editor and Press the Form Properties Button.

2. Select the Parameters Tab.

3. You may then click on the Add Button to create a New Parameters. Make sure to give it a name and set the type.

To pass the information for the Regarding Object we will need to create the following three parameters.

Name Type
parameter_regardingname SafeString
parameter_regardingid UniqueId
parameter_regardingtype SafeString

Sending the Custom Parameters

The following script can be called to open a new Appointment Form and pass the regarding object information to our three custom parameters. You can attach function to a button using the CRM Ribbon Workbench.

function openNewAppointment() {

//set the parameters to pass to the new form  var parameters = {};

var Regarding = Xrm.Page.getAttribute(“regardingobjectid”).getValue();

parameters["parameter_regardingid"] = Regarding[0].id;

parameters["parameter_regardingname"] = Regarding[0].name;

parameters["parameter_regardingtype"] = Regarding[0].entityType;

//Open the new form



Reading the Custom Parameters

The following script can be used to retrieve the Custom Parameters and then use that information to set the regarding object on the appointment.

function loadRegarding(){

// Get the Value of the Regarding through the Customer Parameters

var param=Xrm.Page.context.getQueryStringParameters();

var regardingId=param["parameter_regardingid"];

var regardingName=param["parameter_regardingname"];

var regardingType=param["parameter_regardingtype"];

//Populate the Regarding if there is one

if (regardingId != undefined)

{Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);}




  1. Scotty says:

    This was a great post and used this recently in one of my projects.

    We’re experiencing a strange issue though. If we create a new entity with an association to an Account, say create a Contact associated to it’s parent Account, and press Save & New, the ‘New’ record does not get the association.


  2. Debbie says:

    I have been unable to get this to work – it is giving the error that a ‘;’ symbol is expected on line 1 of the function openNewAppointment() {
    line. What I am trying to do is open a task from a call form while keeping the “Regarding” field. Is there a problem having this code go between entities? Or am I doing something else wrong. I have the on load function above on the Task form and the opennewappointment code (though appointment is replaced with task) in the Call form. I did place the custom parameters into the Call form as well. Any help would be GREATLY appreciated. Thanks,

  3. Debbie says:

    Another thing I just noticed is the custom parameters I add to the form properties keep dropping off
    Thanks in advance for any insight on how I can get this to work.

  4. Debbie says:

    Nevermind…I’m an idiot and had a typo in the code. It is working perfectly now – thanks so much for the post!

  5. Swaroop says:

    Hey,I am trying the same in CRM 2013 but it doesnt seem to work. Did you get a chance to try it in CRM 2013?


  6. Yaqub says:

    It is working perfectly, thanks for the post.

  7. PJC says:

    Thanks for this saved me. :-) can confirm works on 2013

Leave a Reply

Your email address will not be published. Required fields are marked *


× 9 = twenty seven

hermes kelly hermes Outlet hermes Store hermes birkin chanel classic flap louisvuitton handbags louis vuitton outlet cheap Balenciaga cheap louis vuitton