Introduction
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.
Background
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
.
Steps
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
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. 🙂
Regards,
DynamicsCRM@MindfireSolutions
msallin
August 11, 2014 at 1:32 pm
Safed me time! Ty!
DynamicsCRM@MindfireSolutions
August 26, 2014 at 12:39 pm
We are glad to hear that. 🙂
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.