Featured Post

Web API Requests Series

Web API Series:  Create and Retrieve , Update and Delete , Retrieve Multiple , Associate/Disassociate , Impersonation , Run Workflows

12 August 2011

How to add a custom button in the ribbon menu.

In this post I will walk you through the process of creating a new ribbon button that will be able to open a HTML page from which we can access some crm context parameter such as language id and record id.
In this particular example I will be using the HTML page to host a Silverlight application.
First of all we need to export the solution that we want to customise, so navigate to settings-> Solutions and select the solution you want to export.
Once downloaded the solution open the customizations.xml file with your favourite editor.
Here is my customization:
                <CustomAction Id="Imp.Form.Account.ShowHierarchy" Sequence="51" Location="Mscrm.Form.account.MainTab.ExportData.Controls._children">
                    <Button Id="Imp.Form.Account.ShowHierarchyButton" Image16by16="$webresource:new_Hierarchy16by16.gif" Image32by32="$webresource:new_Hierarchy32by32.gif" TemplateAlias="o1" LabelText="$LocLabels:Imp.Form.Account.ShowHierarchyTitle" ToolTipTitle="$LocLabels:Imp.Form.Account.ShowHierarchyTitle" ToolTipDescription="$LocLabels:Imp.Form.Account.ShowHierarchyTooltip" Command="Imp.Form.Account.ShowAccountHierarchyCommand" />
                  <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
                <CommandDefinition Id="Imp.Form.Account.ShowAccountHierarchyCommand">
                    <Url Address="$webresource:new_/SilverlightFromRibbonTestPage.html" PassParams="true"></Url>
                  <TabDisplayRules />
                  <DisplayRules />
                  <EnableRules />
                <LocLabel Id="Imp.Form.Account.ShowHierarchyTooltip">
                      <Title languagecode="1033" description="This will open a HTML page hosting a Silverlight application." />
                <LocLabel Id="Imp.Form.Account.ShowHierarchyTitle">
              <Title languagecode="1033" description="Open Page" />

Import the new customization.xml file and if you don't have any error you should be able to see a new button on the account form.

Hope you find this post useful.
Cheers , Luciano.

No comments:

Post a Comment