Asked by:
Open CRM form with parameters

Question
-
Hi,
I want to send mail from custom entity by clicking on button. I created custom entity, button. When I click on the button it will call email activity. I did set up default subject as name of the account. But I could not set regarding field by default. I got error: Object expected when loading the form. Please help me to solve this issue.
I have got few solution but it did not work. Please find below the java code I have used for this.
1. I created 3 parameters. parameter_regardingid,parameter_regardingname,parameter_regardingtype on the form parameters as shown below screen-shot. Publish the form.
2. I added below java code in form onload of custom entity and publish
function Form_onload()
{var param=Xrm.Page.context.getQueryStringParameters();
var regardingId=param["parameter_regardingid"];
var regardingName=param["parameter_regardingname"];
var regardingType=param["parameter_regardingtype"];
if (regardingId != undefined)
{
Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);
}}
3. I added below java codes on button event.
function sendmail()
{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;
Xrm.Utility.openEntityForm("email",null,parameters);
}
pnoushu@hotmail.com
- Split by Andrii ButenkoMVP, Moderator Wednesday, December 18, 2013 1:20 PM
Wednesday, December 18, 2013 1:16 PM
All replies
-
Hi,
I want to open new mail form custom entity. I created one button for this and when I click on this button it open email activity. I need to take default parameters also from custom entity when open the new mail. I have used the following command in java script for this. can you help me how to take default parameters like to,subject from the custom entity.
I have used the following command.
Xrm.Utility.openEntityForm(name,id,parameters)
But I did n't get any good solution to passparamets. How the parameters separate to and subject.
Please help to solve this issue.
Regards,
Noushad
pnoushu@hotmail.com
- Merged by Andrii ButenkoMVP, Moderator Wednesday, December 18, 2013 1:21 PM Same Question
Monday, December 16, 2013 5:27 AM -
Hi,
This is something you can do on-load of the email form. Use the passed in ID to fetch the rest of the details.
Hope this helps.
-----------------------------------------------------------------------
Minal Dahiya
blog : http://minaldahiya.blogspot.com.au/
If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"Monday, December 16, 2013 7:38 AM -
Hi,
Can you give java script to set the default values in To: Subject fields.
Regards,
Noushad
pnoushu@hotmail.com
Monday, December 16, 2013 8:02 AM -
Hello,
Did you check this
To set partylist check this
Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Proposed as answer by HIMBAPModerator Monday, December 16, 2013 8:13 AM
Monday, December 16, 2013 8:13 AMModerator -
Hi,
I want to send mail from custom entity by clicking on button. I created custom entity, button. When I click on the button it will call email activity. I did set up default subject as name of the account. But I could not set regarding field by default. I got error: Object expected when loading the form. Please help me to solve this issue.
I have got few solution but it did not work. Please find below the java code I have used for this.
1. I created 3 parameters. parameter_regardingid,parameter_regardingname,parameter_regardingtype on the form parameters as shown below screen-shot. Publish the form.
2. I added below java code in form onload of custom entity and publish
function Form_onload()
{var param=Xrm.Page.context.getQueryStringParameters();
var regardingId=param["parameter_regardingid"];
var regardingName=param["parameter_regardingname"];
var regardingType=param["parameter_regardingtype"];
if (regardingId != undefined)
{
Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);
}}
3. I added below java codes on button event.
function sendmail()
{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;
Xrm.Utility.openEntityForm("email",null,parameters);
}
pnoushu@hotmail.com
- Merged by Andrii ButenkoMVP, Moderator Wednesday, December 18, 2013 1:22 PM The same thread
Tuesday, December 17, 2013 2:37 PM -
Hi,
I want to send mail from custom entity by clicking on button. I created custom entity, button. When I click on the button it will call email activity. I did set up default subject as name of the account. But I could not set regarding field by default. I got error: Object expected when loading the form. Please help me to solve this issue.
I have got few solution but it did not work. Please find below the java code I have used for this.
1. I created 3 parameters. parameter_regardingid,parameter_regardingname,parameter_regardingtype on the form parameters as shown below screen-shot. Publish the form.
2. I added below java code in form onload of custom entity and publish
function Form_onload()
{var param=Xrm.Page.context.getQueryStringParameters();
var regardingId=param["parameter_regardingid"];
var regardingName=param["parameter_regardingname"];
var regardingType=param["parameter_regardingtype"];
if (regardingId != undefined)
{
Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);
}}
3. I added below java codes on button event.
function sendmail()
{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;
Xrm.Utility.openEntityForm("email",null,parameters);
}
pnoushu@hotmail.com
Tuesday, December 17, 2013 2:58 PM -
Hi,
Please help to solve this issue if any can find solution.
Regards,
pnoushu@hotmail.com
Sunday, December 22, 2013 10:46 AM -
Hi Pnous,
Find the below code to create the email activity and to set the regarding field from the custom entity.
Change your object type code in the customEntityObjectCode variable.
function CreateEmailActivity() {
var customEntityObjectCode = "10003";
var parameters = {};
parameters["partyid"] = Xrm.Page.data.entity.getId();
parameters["partyname"] = Xrm.Page.getAttribute("for_name").getValue();
parameters["partytype"] = customEntityObjectCode;
parameters["pId"] = Xrm.Page.data.entity.getId();
parameters["pName"] = Xrm.Page.getAttribute("for_name").getValue();
parameters["pType"] = customEntityObjectCode;
Xrm.Utility.openEntityForm("email", null, parameters);
}
Regards,
prabhu.it13@gmail.com
Prabhu G
- Proposed as answer by D Suresh Kumar Tuesday, December 31, 2013 3:54 AM
Thursday, December 26, 2013 7:49 AM