locked
CRM 2011 - Hide a ribbon button based on current form name RRS feed

  • Question

  • Hello All,

    I have the account entity with 2 forms named: formA and formB. I have a custom ribbon named ribbonA.

    On loading an account, depend on the value of an custom attribute of account entity, I show formA or formB.

    Is it possible to show ribbonA when formA is displayed and hide it when formB is displayed?

    I did some searches but it seems that we cannot use the CustomRule inside the DisplayRule. Please help...

    Many thanks!

    PS: Jscript to get formId based on its name:

    /* Get form id by name*/
    function getFormSelectorItemByName(nameRoleForm) {
        var formId = null;
        Xrm.Page.ui.formSelector.items.forEach(function (item, index) {
            var itemLabel = item.getLabel();
            if (itemLabel.toLowerCase() == nameRoleForm.toLowerCase()) {
                formId = item.getId();
                return formId;
            }
        });
        return formId;
    }


    • Edited by NGMKha Wednesday, June 27, 2012 5:01 AM
    Wednesday, June 27, 2012 4:57 AM

Answers

All replies