如何在crm中的自定义实体的gridView中添加“sendemail”按钮

时间:2013-04-25 02:43:05

标签: dynamics-crm-2011 dynamics-crm ribbon

有一个名为“添加到广告系列”的自定义实体。由于子网格中没有默认的“电子邮件”按钮,因此我放置了一个自定义按钮并提供了javascript来打开电子邮件表单,并且电子邮件表单打开良好。 但现在的问题是,无法在电子邮件表单的“发送到字段”中获取选定的记录“电子邮件字段”。 那么如何在“电子邮件表格”

中取消选定的录制电子邮件

1 个答案:

答案 0 :(得分:1)

使用参数打开电子邮件表单:

Xrm.Utility.openEntityForm("email", null, param);


var param = {}; // passed as parameters to the new email form
if(Xrm.Page.getAttribute("-- LogicalNameOfField --") // make sure that the field has a value
    param["-- LogicalNameOfFieldInNewEmail --"] = Xrm.Page.getAttribute("-- LogicalNameOfField --"); // passes a field value to the new form
// This passes a lookup field as a parameter to the new form
if(Xrm.Page.getAttribute("-- LogicalNameOfLookup --").getValue() != null) { // make sure that the lookup field is not empty or we will have a problem trying to access [0].id and [0].name
    param["-- LogicalNameofLooupFieldInEmail --"] = Xrm.Page.getAttribute("-- LogicalNameOfLookup --").getValue()[0].id;
param["-- LogicalNameOfLookup --" + "name" (eg. "accountname")] = Xrm.Page.getAttribute("-- LogicalNameOfLookup --"].getValue()[0].name;
Xrm.Utility.OpenEntityForm("LogicalEntityName", null, param); // open the form and pass parameters

记下查找字段如何作为参数传递:

  • 为每个查找字段传递2个参数
  • GUID作为查找字段的名称(如果是新帐户中的查询字段名称,则为帐户)
  • 源实体中的查找名称作为特殊参数(accountname)
  • 注意:没有名为“accountname”的字段,但在此假设实体中有一个名为“account”的字段