locked
Hiding a Custom button in a ribbon RRS feed

  • Question

  • Hi guys..

                    I   want   to   hide   a   custom   button   in   ribbon   for   a   single   stage   in   a   sales   process..

    For remaining stages,it must be visible..

    Is this possible?!

     

                    

                   

    Wednesday, October 19, 2011 9:09 AM

All replies

  • Hi Mate

    you can use the DisplayRule and ValueRule to do that.

    here is example

    http://howto-mscrm.blogspot.com/2011/04/how-to-series-5-how-to-use-valuerule.html

    In this example he is using valuerule with enablerule but you need to use the valuerule with <DisplayRule>

    here is link to valuerule msdn

    http://msdn.microsoft.com/en-us/library/gg334317.aspx and here is the one on displayrule

    http://msdn.microsoft.com/en-us/library/gg328560.aspx

     


    Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com
    • Proposed as answer by Amreek Singh Wednesday, October 19, 2011 12:22 PM
    Wednesday, October 19, 2011 12:22 PM
  • Hi mate,

    Thanks for your reply..

    I tried it..but it dint work..

    I guess,the problem is with enable rule id.

     

    could  you please explain on what basis should we
    write enable rule id..

    <EnableRule Id="Sample.account.form.OrRule.EnableRule">

    \\this is rule id in vikranth'sblog..

    Cheers,

    Naveen

    Friday, October 21, 2011 9:07 AM
  • there is nothing wrong with the Id. It's just an id

    you can change it anything

    <EnableRule Id="naveenrule">

    then when you define the rule it will look like

               <EnableRule Id="naveenrule">
                  <OrRule>
                    <Or>
                      <ValueRule Field="fax" Value="null" InvertResult="true"/>
                    </Or>
                    <Or>
                      <ValueRule Field="address1_addresstypecode" Value="1"/>
                    </Or>
                  </OrRule>
                </EnableRule>

    For hiding you need to replace enablerule to displayrule.

    Check my blog on enable and disable the existing button

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

    In the blog

    the following part will be change

    <CustomRule FunctionName="HideExisting" Library="$webresource:new_CustomRule.js" Default="false" >
             
    <CrmParameter Value="PrimaryEntityTypeCode" />
           
    </CustomRule>

    with

    <ValueRule Field="fieldname" Value="1"/> // if the value of the 1 the button will be enabled otherwise disable

    As i said earlier to hide and display use displayrule

    in display rule

    <ValueRule Field="fieldname" Value="1"/> // if the value of the 1 the button will be displayed otherwise hidden

     


     

     


    I hope this helps.


    Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com
    • Edited by Amreek Singh Friday, October 21, 2011 11:31 AM
    • Proposed as answer by Amreek Singh Friday, October 21, 2011 11:31 AM
    Friday, October 21, 2011 11:15 AM