|
![]() |
#1 |
Участник
|
Gareth Tucker: Adding a new Button Group to the CRM Ribbon
Источник: http://gtcrm.wordpress.com/2011/08/2...he-crm-ribbon/
============== Here’s a quick run through on how to add a new Group of buttons to the ribbon in Microsoft CRM 2011. Here’s the end result that will be achieved: ![]() In this scenario we are customising the Phone Call entity’s Form ribbon. In particular the Main Tab of that ribbon (the tab that carries the name of the Entity). To implement this change we need to customise the Phone Call entity. At present CRM does not provide a UI for Ribbon customisations but the customisation XML does support these changes. So we need the Phone Call entity’s customization xml. Create a Solution, add the Phone Call entity, export the solution, unzip and then open the customization.xml file in Visual Studio. Collapse the EntityInfo and FormXml nodes and you should see the RibbonDiffXml node, this is where we specify changes to the Ribbon. Replace the CustomActions line with the following XML: </p> Sequence="110"> </p> Title="Gareths Group" Sequence="51" Template="Mscrm.Templates.Flexible2"> </p> Sequence="10" LabelText="Button 1" ToolTipTitle="TipTitle" ToolTipDescription="TipDescription" TemplateAlias="o1" Image16by16="/_imgs/ribbon/newchart16.png" Image32by32="/_imgs/ribbon/newchart32.png" /> </p> Sequence="20" LabelText="Button 2" ToolTipTitle="TipTitle" ToolTipDescription="TipDescription" TemplateAlias="o1" Image16by16="/_imgs/ribbon/CustomEntity_16.png" Image32by32="/_imgs/ribbon/CustomEntity_32.png" /> </p> Sequence="120"> </p> Sequence="21" Size="LargeLarge" /> </p> Sequence="140"> </p> Sequence="85" Size="Popup" />
Do a Find and Replace on “phonecall”, replacing with the name of your entity. Change the Location value on line 3 to the relevant Group ID of your entity’s Ribbon definition. I’ll explain. In my scenario I wanted to add a Button Group to the Phone Call form’s Main tab so I went and found the Phone Call ribbon definition in the SDK here: \sdk\samplecode\cs\client\ribbon\exportribbonxml\exportedribbonxml\phonecallribbon.xml And looked for my Tab in that file, finding it here (see the yellow highlight below): ![]() I wanted to add a new Group under the Groups section of the Ribbon so the Location value in our customization file needs to be that Groups Id (highlighted in green above) – appended with ._children. i.e.: ![]() That’s all you need to change at this stage. We’ll come back and personalise other settings in a sec, let’s just try and get the button group to appear first. Ok, now we need to add some commands to our customization file. Replace the CommandDefinitions line with the following XML:
Change the URL being launched by each button or replace s jscript function call like the below: ![]() And find a Display Rule and Enable Rule in your entity’s ribbon.xml that you can use. You can’t just use my “Mscrm.ConvertActivity” rule as it may not exist on your entity. Ok, that should be enough to get our buttons to appear. To deploy, zip back up the customization.xml file along with it’s other solution files and then import that solution zip file back into CRM and Publish. Pop your form and you should now see the new Button group and it’s 2 buttons: ![]() To adjust the appearance you can now go back and tweak some of the XML attributes (after which you would re-zip, import and publish). To change where the Group appears on the Ribbon change the Sequence value under the Group node: ![]() Refer back to the entity’s ribbon.xml to see what sequence each existing Group has to figure out what value you need to slot your in between: ![]() Change the Button Group label and the label of the individual buttons here: ![]() Change the Button icon here: ![]() You have 2 approaches for setting the button icons. You can browse the entity’s ribbon.xml (or any entity’s ribbon.xml for that matter, or even applicationribbon.xml) and steal the path and filename of a button you want to use. Or, you can upload your own button icons as web resources and then reference the web resource, which is done in this manner: Image16by16="$webresource:new_star16x16" Image32by32="$webresource:new_star32x32" ![]() Gareth. ![]() Источник: http://gtcrm.wordpress.com/2011/08/2...he-crm-ribbon/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|