<?xml version="1.0" encoding="utf-8"?>
<RibbonDiffXml>
  <CustomActions>
    <HideCustomAction HideActionId="vhacrm.Mscrm.Form.vhacrm_correspondence.SaveAndClose.Hide" Location="Mscrm.Form.vhacrm_correspondence.SaveAndClose" />
    <CustomAction Id="vhacrm.vhacrm_correspondence.MailMergeButton.CustomAction" Location="Mscrm.Form.vhacrm_correspondence.MainTab.Save.Controls._children" Sequence="25">
      <CommandUIDefinition>
        <Button Alt="$LocLabels:vhacrm.vhacrm_correspondence.MailMergeButton.Alt" Command="Mscrm.MailMergePrimary" Id="vhacrm.vhacrm_correspondence.MailMergeButton" Image32by32="/_imgs/ribbon/mailmerge16.png" Image16by16="/_imgs/ribbon/mailmerge16.png" LabelText="$LocLabels:vhacrm.vhacrm_correspondence.MailMergeButton.LabelText" Sequence="25" TemplateAlias="o2" ToolTipTitle="$LocLabels:vhacrm.vhacrm_correspondence.MailMergeButton.ToolTipTitle" ToolTipDescription="$LocLabels:vhacrm.vhacrm_correspondence.MailMergeButton.ToolTipDescription" ModernImage="/_imgs/ribbon/mailmerge16.png" />
      </CommandUIDefinition>
    </CustomAction>
  </CustomActions>
  <Templates>
    <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
  </Templates>
  <CommandDefinitions>
    <CommandDefinition Id="Mscrm.MailMergePrimary">
      <EnableRules>
        <EnableRule Id="Mscrm.FormStateExistingOrReadOnly" />
        <EnableRule Id="Mscrm.IsNotIos" />
      </EnableRules>
      <DisplayRules>
        <DisplayRule Id="Mscrm.MailMergePrimary" />
      </DisplayRules>
      <Actions>
        <JavaScriptFunction FunctionName="onActionMenuClick" Library="/_static/_forms/form.js">
          <StringParameter Value="webmailmerge" />
          <CrmParameter Value="PrimaryEntityTypeCode" />
        </JavaScriptFunction>
      </Actions>
    </CommandDefinition>
  </CommandDefinitions>
  <RuleDefinitions>
    <TabDisplayRules />
    <DisplayRules>
      <DisplayRule Id="Mscrm.HideOnCommandBar">
        <OrRule>
          <Or>
            <CommandClientTypeRule Type="Legacy" />
          </Or>
          <Or>
            <PageRule Address="/userdefined/edit.aspx" />
          </Or>
          <Or>
            <PageRule Address="/advancedfind/advfind.aspx" />
          </Or>
          <Or>
            <PageRule Address="/advancedfind/fetchData.aspx" />
          </Or>
          <Or>
            <PageRule Address="/tools/formeditor/formeditor.aspx" />
          </Or>
          <Or>
            <PageRule Address="/tools/visualizationdesigner/visualizationdesigner.aspx" />
          </Or>
        </OrRule>
      </DisplayRule>
      <DisplayRule Id="Mscrm.MailMergePrimary">
        <EntityPropertyRule AppliesTo="PrimaryEntity" PropertyName="MailMergeEnabled" PropertyValue="true" />
        <EntityPrivilegeRule PrivilegeType="Create" PrivilegeDepth="Basic" EntityName="activitypointer" />
        <MiscellaneousPrivilegeRule PrivilegeName="MailMerge" />
        <OrRule>
          <Or>
            <MiscellaneousPrivilegeRule PrivilegeName="WebMailMerge" />
          </Or>
          <Or>
            <CrmClientTypeRule Type="Outlook" />
          </Or>
        </OrRule>
      </DisplayRule>
    </DisplayRules>
    <EnableRules>
      <EnableRule Id="Mscrm.FormStateExistingOrReadOnly">
        <OrRule>
          <Or>
            <FormStateRule State="ReadOnly" />
          </Or>
          <Or>
            <FormStateRule State="Existing" />
          </Or>
        </OrRule>
      </EnableRule>
      <EnableRule Id="Mscrm.IsNotIos">
        <CustomRule FunctionName="Mscrm.IsIos_0" Library="$Webresource:Ribbon_main_system_library.js" InvertResult="true" />
      </EnableRule>
    </EnableRules>
  </RuleDefinitions>
  <LocLabels>
    <LocLabel Id="vhacrm.vhacrm_correspondence.MailMergeButton.Alt">
      <Titles>
        <Title description="Mail Merge" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="vhacrm.vhacrm_correspondence.MailMergeButton.LabelText">
      <Titles>
        <Title description="Mail Merge" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="vhacrm.vhacrm_correspondence.MailMergeButton.ToolTipDescription">
      <Titles>
        <Title description="Mail Merge" languagecode="1033" />
      </Titles>
    </LocLabel>
    <LocLabel Id="vhacrm.vhacrm_correspondence.MailMergeButton.ToolTipTitle">
      <Titles>
        <Title description="Mail Merge" languagecode="1033" />
      </Titles>
    </LocLabel>
  </LocLabels>
</RibbonDiffXml>