2
votes

I need to add button sending e-mail with default client on MS CRM 2011 ribbon.

I've added following section to 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:[email protected]" />
    </Actions>
  </CommandDefinition>
</CommandDefinitions>

And it works. However on button click it opens new window. Which stays empty, since it's nothing to display — just call e-mail client.

Is there any workaround? How to start e-mail client without opening new window?

1
is an Internet Explorer issue, not so related to CRMGuido Preite
@Guido I'm using Firefox mostly. And behavior is the same in both browsers.shytikov
ok, where is located exactly this button? inside the homepage bside the exporting tool only for a selected entity?Guido Preite
It's on main application ribbon, on every entity, nearby "Advanced Find" button. Rightmost location.shytikov

1 Answers

1
votes

Found a solution.

Change your action to a JavaScript one, like:

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

and the contactsupport function will be:

function contactsupport() {
   location.href = 'mailto:[email protected]';
}

looks like that setting location.href inside CRM doesn't change the url, but works to launch the application associated to mailto

tested with IE 9, Chrome 27, Firefox 21