locked
Hide Ribbon button failing RRS feed

  • Question

  • I am trying to hide the Delete button on the Service Activity form when the user is creating a new Service Activity. This code seems fine from what I can read from the tutorials on the web, but it is throwing an error when I try to import the solution.

     

     

    <RibbonDiffXml>
    	<CustomActions>				
    <HideCustomAction Location="Mscrm.Form.serviceappointment.Delete" HideActionId="Mscrm.Form.serviceappointment.DeleteHideButton"/>
    	</CustomActions>
            <Templates>
              <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
            </Templates>
            <CommandDefinitions />
            <RuleDefinitions>
              <TabDisplayRules />
              <DisplayRules>
    		<DisplayRule Id="HideDeleteButtonDisplayRule">
    			<FormStateRule State="Create" />
    		</DisplayRule>
    	 </DisplayRules>
             <EnableRules />
            </RuleDefinitions>
            <LocLabels />
    </RibbonDiffXml>
    

     


    The error is:

     

    The ribbon item 'Mscrm.Form.serviceappointment.DeleteHideButton' is dependent on ribbon control id='Mscrm.Form.serviceappointment.Delete'

     

    I have the Service Acitivity entity imported in my solution. Also, I am using CRM 2011.

     

    Thanks





    • Edited by KatRiketa Tuesday, October 4, 2011 9:09 PM
    Tuesday, October 4, 2011 9:08 PM

All replies

  • Hi,

    <HideCustonAction> does not support any ribbon rules, it will only hide the button (http://msdn.microsoft.com/en-us/library/gg309469.aspx). I you want to hide the Delete button on form create then you need you may have to export the serviceappointment entity exsisting ribbon and add the display rule and then can import back. You may follow the steps mentioned in the following post , instead of renaming a label you can add the display rule as per required (http://dynamiccrm.blogspot.com/2011/08/changing-oob-ribbon-button-label-in-crm.html)

    You can export the system ribbon xml file using a utility available in CRM 2011 SDK at location CRM2011SDK\samplecode\cs\client\ribbon\exportribbonxml , you have to run the project in VS and then run the project and it will build the ribbon xml files then Export Ribbon Solution along with entity, Open the Customizations.Xml in Visual Studio and include the required ribbon button Xml code from the generated ribbon xml file


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Tuesday, October 4, 2011 9:56 PM
  • Hi Maleeee

    There are few things. You don't need anything else except <CustomActions>
    <HideCustomAction Location="Mscrm.Form.serviceappointment.Delete" HideActionId="Mscrm.Form.serviceappointment.DeleteHideButton"/>
    </CustomActions>
     to hide a button.

    Get rid of the following code. I assume you do not want to hide a button just on create, as it is disable on create by default.

    <DisplayRule Id="HideDeleteButtonDisplayRule">
    <FormStateRule State="Create" />
    </DisplayRule>
     

    Just to clarify, defining a displayrule or enablerule won't work, you need to call them in <CommandDefinitions />

    I have a look at this

    http://mscrmshop.blogspot.com/2011/08/enabledisable-out-of-box-buttons-based.html

    I hope this helps. 

     


    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    • Proposed as answer by Amreek Singh Tuesday, October 4, 2011 11:48 PM
    Tuesday, October 4, 2011 11:48 PM
  • I think the real answer is : You can't use Mscrm as a the beginning of a custom id when customizing the ribbon...

    Replace Mscrm by anything else...

    I can't find out a source about this but I'm pretty sure about it


    My blog : http://mscrmtools.blogspot.com

    All my tools for Dynamics CRM 4.0 on my dedicated site: MSCRMTools Repository

    Wednesday, October 5, 2011 7:19 AM
    Moderator