我需要在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>
它有效。但是在按钮上单击它会打开新窗口。它保持空白,因为它无需显示 - 只需调用电子邮件客户端。
有没有解决方法?如何在不打开新窗口的情况下启动电子邮件客户端?
答案 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测试