将按钮打开电子邮件客户端添加到MS CRM 2011功能区

时间:2013-05-30 10:54:37

标签: xml dynamics-crm-2011

我需要在MS CRM 2011功能区上添加使用默认客户端发送电子邮件的按钮。

我已将以下部分添加到customizations.xml

<CustomActions>
  <CustomAction Id="Company.{!EntityLogicalName}.MainTab.ContactSupport.CustomAction"
                Location="Mscrm.HomepageGrid.{!EntityLogicalName}.MainTab.ExportData.Controls._children"
                Sequence="72">
    <CommandUIDefinition>
      <Button Id="Company.{!EntityLogicalName}.MainTab.ContactSupport.Button"
              Command="Company.all.MainTab.HelpGroup.ContactSupport.Command"
              LabelText="Contact Support"
              ToolTipTitle="Contact project support via e-mail"
              ToolTipDescription="Contact project support via e-mail"
              TemplateAlias="o3"
              Image16by16="/_imgs/ribbon/senddirectmail_16.png"
              Image32by32="/_imgs/ribbon/senddirectmail_32.png" />
    </CommandUIDefinition>
  </CustomAction>
</CustomActions>
...
...
...
<CommandDefinitions>
  <CommandDefinition Id="Company.all.MainTab.HelpGroup.ContactSupport.Command">
    <EnableRules />
    <DisplayRules />
    <Actions>
      <Url Address="mailto:Support@support.com" />
    </Actions>
  </CommandDefinition>
</CommandDefinitions>

它有效。但是在按钮上单击它会打开新窗口。它保持空白,因为它无需显示 - 只需调用电子邮件客户端。

有没有解决方法?如何在不打开新窗口的情况下启动电子邮件客户端?

1 个答案:

答案 0 :(得分:1)

找到解决方案。

将您的操作更改为JavaScript,例如:

<Actions>
      <JavaScriptFunction FunctionName="contactsupport"  Library="$webresource:new_contactsupport.js" />
</Actions>

并且contactsupport函数将是:

function contactsupport() {
   location.href = 'mailto:Support@support.com';
}

看起来CRM中的设置location.href不会更改网址,但可以启动与mailto相关联的应用

使用IE 9,Chrome 27,Firefox 21测试