In this part I am going to show how we can create a custom button on existing tab. Basically when adding custom button first you need to decide where you want to put this button, as we want to add new button in existing tab we have two option for this
1. Add button on existing group in Existing Tab.
2. Add button on new group in Existing Tab.
In this post I am going do implement Option 1. let’s take example and let consider we want to add a button on existing tab in account entity. You can see in account’s tab we have group like save, collaborate, process and
So if we want to add a new button in existing Account tab in any of these groups let’s say we want to add in “Process” group.
So adding button on existing tab or group we need to know id of the parent group, that you can get from sample application provided in MS CRM 2011 SDK under “\sdk\samplecode\cs\client\ribbon\exportribbonxml” location. Open this project and run it will ask your crm server name and organization detail and will generate entity ribbons.
We are trying to modify Account ribbon so we need to check id in accout ribbon open account ribbon in visual studio or any xml editor. Our goal is to add button on account form and in process group so check for “Mscrm.Form.account.MainTab.Workflow” and copy group id like below
Now we have group id with us let’s create a solution with account entity
Follow below steps to create solution
- Goto setting->Solution->New
- Enter General information and save.
- Select Entities->Click on Add Existing and select Account.
Your solution should look like below
4. Export solution as unmanaged.
5. Unzip your solution and open customizatio.xml in visual studio or in other xml editor.
6. Search for <RibbonDiffXml> tag
7. We need to modify above xml to extend account ribbon. We need to add a node <CustomAction> under <CustomActions> node to add custom button.
There are basically 3 pionts here that we need concentrate
i. Mscrm.Form.account.MainTab.Workflow.Controls._children – we need to use location value as parent id+”_children” keyword to create custom button on existing group.
ii. Sequence – we need to set sequence of custom action and our button greater than existing values for that group
iii. Command- we need to define command that we want to use for our custom button.
8. We need to define a command definition for our button like below, we need to make sure that we are using the same id that we used in button node.
<EnableRule Id=”Mscrm.Enabled” />
<Url Address =”www.google.com”></Url>
- save and zip your solution again and import.
- Publish all customization.
- Open account entity form you will get a button like below.
In next post I will cover “Add button on new group in Existing Tab”.