Now with Dynamics CRM 2011 we have a fully supported way to interact with and change most aspects of the ribbon, including removing the add existing button. For today’s article I’ll step through how to remove the “Add Existing” button from the Contacts Associated view. First we will create a new solution to house our changes and add the Contact entity to this solution.
Navigate to Settings, Solutions and create a new solution. Give your solution a name, add a publisher, version and click save. I’ve called mine “Remove Add Existing Button”.
Next add the contact entity to your solution. We do this by navigating to Components within the solution and clicking “Add Existing” and Entity. Select the Contact Entity.
We are now ready to export your solution and edit the customisation.xml file. Click “Export Solution” and follow the prompts (Don’t select any other items to export as you navigate the prompts and select unmanaged as your package type).
Navigate to where you saved your solution zip file and unzip the it. Your unzipped directory should look like this.
Open the customisations.xml file. I would suggest using Visual Studio or an xml editor to edit this file. Search for the following section in the customisations.xml file:
We are going to replace the <CustomActions /> element with the following:
Once we’ve done that, save and close your customisations.xml and add it back to your solution zip file, overwriting the existing customisations.xml file.
We can now re-import our solution file. Navigate back to CRM and Settings, Solutions and click “Import”
Step through the prompts and your solution will be re-imported. Once your import is successful, click “Publish All Customisations”
If you navigate to Accounts, select an account and then navigate to the associated contacts, you will see that the “Add Existing” button has been removed. Below you can see the “Add Existing” button in the Associated Contact view before we removed it.
and after we removed it.
You can use this concept for any entity. Repeat the above steps for the entity /entities you wish to remove the “Add Existing” button for and in the customisations.xml file for each entity replace “contact” with the name name of you entity under that entities <RibbonDiffXml> element as per the below.
<HideCustomAction Location="Mscrm.SubGrid.<entity name here>.AddExistingStandard"
HideActionId="Sample.Mscrm.SubGrid.<entity name here>.AddExistingStandard.HideAction" />
For your reference I have attached the solution file I created for this example here: RemoveAddExistingButton_1_0_0_0.zip
I love the solution concept in 2011! Be warned this is an unmanaged solution and hence you cannot roll it back. Put it in a test or dev environment first!