Saturday, June 4, 2011

Hide Custom Button when form is in create mode


 <RibbonDiffXml>
        <CustomActions>
          <CustomAction Id="org.button.Form.CustomAction" Location="Mscrm.Form.account.MainTab.Save.Controls._children" Sequence="1">
            <CommandUIDefinition>
              <Button Id="org.button.Form.WhatifButton" Command="org.button.Command" LabelText="What If Analysis" ToolTipTitle="Launch" ToolTipDescription="tooltip" TemplateAlias="o1" Image16by16="$webresource:neu_button16x16" Image32by32="$webresource:neu_button32x32" />
            </CommandUIDefinition>
          </CustomAction>
        </CustomActions>
        <Templates>
          <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
        </Templates>
        <CommandDefinitions>
          <CommandDefinition Id="org.button.Command">
            <EnableRules>
              <EnableRule Id="org.account.WebClient.EnableRule" />
            </EnableRules>
            <DisplayRules>
              <DisplayRule Id="org.account.WebClient.DisplayRule" />
            </DisplayRules>
            <Actions>
              <Url Address="$webresource:helloworld.html" PassParams="true" WinMode="0" WinParams="width=1100,height=760,toolbar=no,location=no,resizable =yes" />
            </Actions>
          </CommandDefinition>
        </CommandDefinitions>
        <RuleDefinitions>
          <TabDisplayRules />
          <DisplayRules>
            <DisplayRule Id="org.account.WebClient.DisplayRule">
              <FormStateRule State="Create"
                              InvertResult="true" />
            </DisplayRule>
          </DisplayRules>
          <EnableRules >
            <EnableRule Id="org.account.WebClient.EnableRule">
              <CrmClientTypeRule Type="Web" />
            </EnableRule>
          </EnableRules>
        </RuleDefinitions>
        <LocLabels />
      </RibbonDiffXml>

1 comment: