CRM 2013 – Passing Custom Parameters to OpenEntityForm Function

04 Dec


As we know that Microsoft included Xrm.Utility functions for Microsoft Dynamics CRM 2011, but when trying to pass custom parameters to OpenEntityForm as mentioned by Xrm.Utility Reference, I get following CRM Error.



In one of my projects, I need to open a new Email on save of Phone Call Activity and pass the parameters to the new opening Email form. But using the Xrm.Utility Reference link, I got the error as given above. Hence I had found a work around to pass the custom parameters to OpenEntityForm.


Here are the steps to pass the custom parameters:

Step-1: Add parameters in Email Entity Form.


Step-2: Setting custom parameters to pass to the new Email form.

//method call on save of phone call activity
function OpenNewEmail()
    //set the parameters to pass to the new form
    var parameters = {};
    parameters["regarding_Id"] =Xrm.Page.getAttribute("regardingobjectid").getValue()[0].id;
    parameters["regarding_name"] = Xrm.Page.getAttribute("regardingobjectid").getValue()[0].name;
    parameters["regarding_type"] = Xrm.Page.getAttribute("regardingobjectid").getValue()[0].entityType;

    //Open the new form
    Xrm.Utility.openEntityForm("email", null, parameters);

Step-3: Get the custom parameters in Email Entity Form.

function OnFormLoad()
    // Get the Value of the Regarding through the Custom Parameters
    var xrmObject= Xrm.Page.context.getQueryStringParameters();
    var leadName = xrmObject["regarding_name"].toString();
    var leadId = xrmObject["regarding_Id"].toString();
    var entityType = xrmObject["regarding_type"].toString();

By Sukanta Mangal
Software Engineer @Team DynamicsCRM.
Mindfire Solutions


Posted by on December 4, 2013 in WebResources


Tags: , , , , , , , , , , , , , , , , ,

6 responses to “CRM 2013 – Passing Custom Parameters to OpenEntityForm Function

  1. Alex Yeoman

    February 20, 2014 at 11:04 am

    Worth pointing out that if you are passing the type parameter, you need to use type SafeString NOT EntityType when configuring the parameters on the form. It was only after discovering this that I got it all working again.

    • DynamicsCRM@MindfireSolutions

      February 21, 2014 at 6:44 am

      Hello Alex,

      Thanks for your time. Please read our Blogs regularly and stay updated. 🙂


  2. msallin

    August 11, 2014 at 1:32 pm

    Safed me time! Ty!

  3. msallin

    August 11, 2014 at 1:33 pm

    Reblogged this on xRM & .Net Development and commented:
    Eigene QueryStringParameter an Formular übergeben und im JavaScript darauf zugreifen.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: