Wednesday, 22 February 2012

creating ribbon button

Create a temp solution and add the new/existing entity where we like to create the custom ribbon button,
then export the solution as unmanaged and then unzip the file and open the cusomization.xml file
and update the  RibbonDiffXml node,
If using Visual Studio, go to XML option and select "Schemas..." then add the schema file "customizationssolution.xsd" available in the crm2001 sdk at "sdk\schemas", doing this validates the xml file



<RibbonDiffXml>
  <CustomActions>
    <CustomAction Id="publishername.Homepage.entityname.CustomTab.Groups" Sequence="40" Location="Mscrm.SubGrid.entityname.MainTab.Workflow.Controls._children">
      <CommandUIDefinition>
        <Button Id="publishername.Homepage.entityname.CustomTab.FirstGroup.FirstButton" Sequence="11" TemplateAlias="o1" Image32by32="$webresource:publishername_clientemail16.gif" Image16by16="$webresource:publishername_clientemail32.gif" Alt="$LocLabels:publishername.entityname.CustomTab.FirstGroup.FirstButton.LabelText" LabelText="$LocLabels:publishername.entityname.CustomTab.FirstGroup.FirstButton.LabelText" Command="publishername.Homepage.entityname.FirstButton" ToolTipDescription="$LocLabels:publishername.entityname.CustomTab.FirstGroup.FirstButton.ToolTipDescription" ToolTipTitle="$LocLabels:publishername.entityname.CustomTab.FirstGroup.FirstButton.LabelText"/>
      </CommandUIDefinition>
    </CustomAction>
  </CustomActions>
  <Templates>
    <RibbonTemplates Id="Mscrm.Templates"/>
  </Templates>
  <CommandDefinitions>
    <CommandDefinition Id="publishername.Homepage.entityname.FirstButton">
      <EnableRules>
        <EnableRule Id="Mscrm.Enabled "/>
      </EnableRules>
      <DisplayRules>
        <DisplayRule Id="publishername.contact.WebClient.DisplayRule"/>
      </DisplayRules>
      <Actions>
        <JavaScriptFunction Library="$webresource:new_javascript" FunctionName="SelectedGridIds">
          <CrmParameter Value="SelectedControlSelectedItemIds"></CrmParameter>
        </JavaScriptFunction>
      </Actions>
    </CommandDefinition>
  </CommandDefinitions>
  <RuleDefinitions>
    <TabDisplayRules/>
    <DisplayRules>
      <DisplayRule Id="publishername.contact.WebClient.DisplayRule">
        <CrmClientTypeRule Type="Web"/>
      </DisplayRule>
    </DisplayRules>
    <EnableRules/>
  </RuleDefinitions>
  <LocLabels>
    <LocLabel Id="publishername.entityname.CustomTab.FirstGroup.FirstButton.LabelText">
      <Titles>
        <Title languagecode="1033" description="Do Action"/>
      </Titles>
    </LocLabel>
    <LocLabel Id="publishername.entityname.CustomTab.FirstGroup.FirstButton.ToolTipDescription">
      <Titles>
        <Title languagecode="1033" description="Perform action on selected items in subgrid"/>
      </Titles>
    </LocLabel>
  </LocLabels>
</RibbonDiffXml>

--------------------------

Enable rule for existing record

 <EnableRules>
            <EnableRule Id="prefix.entity.Command.Existing">
              <FormStateRule State="Existing"/>
            </EnableRule>
          </EnableRules>

No comments:

Post a Comment