locked
Hide the ribbon button Dynamic CRM RRS feed

All replies

  • hi luuha,

    try this. you can solve your problem

    http://garethtuckercrm.com/2011/02/23/hiding-a-ribbon-button-in-crm-2011/

    and the best way is to use Visual Ribbon Editor tool or Pragma tool to hide ribbon buttons.! Easiest way to do.

    Mark as Answer, if this helps you.

    Friday, November 9, 2012 11:58 AM
  • HI there,

    Because i have 2 ribbon button. And when i click on navigation lef menu link A -< ribbon button B is hide. And when i click on navigation left menu link B- > thr ribbon button A is hide

    So i've try 

    if (typeof (SDK) == "undefined")
    { SDK = {}; }
    SDK.PersonFormOnLoad = {
        hideRibbonButtonById: function (buttonId) {
            var button = top.document.getElementById(buttonId);
            if (!isUndefined(button) && !isUndefined(button.style)) {
                button.style.display = '';
            }
        },

        addRelatedPersonOnClick: function () {
            if (document.getElementById(NAVIGATION_A_ID) != null) {
                document.getElementById(NAVIGATION_A_ID).onclick = function () {
                    SDK.PersonFormOnLoad.hideRibbonButtonById(RIBBON_BUTTON_B_ID);
                }
            }
            if (document.getElementById(NAVIGATION_B_ID) != null) {
                document.getElementById(NAVIGATION_B_ID).onclick = function () {
                    SDK.PersonFormOnLoad.hideRibbonButtonById(RIBBON_BUTTON_A_ID);
                }
            }
        }
    };

    At last i call SDK.PersonFormOnLoad.addRelatedPersonOnClick() at the onload() method of person entity

    But when i open the form and click on the navigation, both ribbon button is not display

    I've debug on it and get the null value of button

    Saturday, November 10, 2012 3:47 AM
  • hi,

    check this line properly

    var button = top.document.getElementById(buttonId);

    getElementById method accepts string

    Saturday, November 10, 2012 3:55 AM
  • I've checked

    I try to get "Run workflow" on the ribbon, and i can get it by element by id.

    But i dont know why i can not get my ribbon button by id, its always null

    Saturday, November 10, 2012 4:07 AM