Sunday, July 17, 2011

Step by Step - Hiding “Add Existing” button in CRM 2011

In MSCRM 4.0, hiding the “Add Existing” button was a very common request. This blog will show how to do this in CRM 2011. When we click on associated record link in left navigation of an entity form, we can see a "Add Existing" button on the ribbon. To hide this button we need to modify the ribbon of the associated entity.
The following screen shot is of an account entity. If we click on "Contacts" on left navigation, we can see the "Add Existing Contact" button on the ribbon. To hide this button we need to modify the ribbon of the contact entity.
image
Here are the steps
  • Create a new solution.
  • Add the contact entity to the solution. Do not include any required components or dependent components to the solution.
  • Export the solution and unzip the solution file.
  • Open the customizations file and look for “<RibbonDiffXml>” tag.
  • Replace the <CustomActions /> with
<CustomActions>
  <HideCustomAction Location="Mscrm.SubGrid.contact.AddExistingAssoc" HideActionId="Mscrm.SubGrid.contact.AddExistingAssoc.HideAction" />
  <HideCustomAction Location="Mscrm.SubGrid.contact.AddExistingStandard" HideActionId="Mscrm.SubGrid.contact.AddExistingStandard.HideAction" />
</CustomActions>
  • Save the file.
  • Replace the customizaions.xml file in your zip solution with this file.
  • Import the solution and publish the changes.
Note: Replace the highlighted "contact” text with your entity name. It can be “opportunity” or a custom entity like “new_entity” etc.

Good day…………..

11 comments:

  1. Dear singh,
    Good post.I have added contact entity as subgrid in account form, I want to hide Addnewcontact button only in account entity, which means if I click related contacts in Lead entity it should display Addnewcontact button , and in account entity it should not display
    Please help me if we can do it in a supported way

    ReplyDelete
  2. Hi Mate,
    This is exactly you are trying to do. Just change the buttonid..
    http://mscrmshop.blogspot.com/2011/08/enabledisable-out-of-box-buttons-based.html

    Good Luck..

    ReplyDelete
  3. hi,
    if i click on subgrid it wil shw the Ribbon up on the page --but here i am having two subgrids on same entity,if i click on first subgrid ribbon must be hide and if i click on second subgrid it must be visible---Can pls post the solution for this

    ReplyDelete
  4. you need to use displayrule
    Have a look at this
    http://mscrmshop.blogspot.com/2011/08/enabledisable-out-of-box-buttons-based.html

    ReplyDelete
  5. Hi,
    can you help me please? I want to do this same thing but not for all users. Can I use javascript to hide this same button (add existing) but only for some users (roles)? Tnx

    ReplyDelete
  6. This won't work for that. You can't use the either as does not support . your only option is to enable and disable button based on the role.
    Have a look at this
    http://mscrmshop.blogspot.com/2011/08/enabledisable-out-of-box-buttons-based.html

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Hi there just wanted to give you a quick heads up.

    The words in your article seem to be running off the screen in Chrome.
    I'm not sure if this is a formatting issue or something to do with internet browser compatibility but I thought I'd post to let you
    know. The layout look great though! Hope you get the problem resolved
    soon. Thanks

    Here is my webpage; luggage tag

    ReplyDelete