Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

How to hide/show Ribbon Work Bench button

(0) ShareShare
ReportReport
Posted on by

Hi,

I would like to hide/show ribbon buttons based on a lookup field in my form.

My condition is If the lookup has a value of "Checked In" than button should not display otherwise it should display.

Thanks

  • gdas Profile Picture
    50,091 Moderator on at
    RE: How to hide/show Ribbon Work Bench button

    I did a test using Value Rule with lookup field value set to GUID and  also name but its not working . So use CustomRule  and try with  above shared code.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: How to hide/show Ribbon Work Bench button

    Hi,

    I would recommend to go for JS rule , where get the lookup text and return true/false. Here is the code - 

    function RibbonShowHideButton() {
        var returnResult = false;
        var statusObj = Xrm.Page.getAttribute("taqi_checkoutstatus").getValue();
        var statusVal = null;
        if (statusObj != null) {
            statusVal = statusObj[0].name;
            if (statusVal.toLowerCase() == "checked in") {
                returResult = true;
            }
        }
        return returnResult;
    }
    


  • Community Member Profile Picture
    on at
    RE: How to hide/show Ribbon Work Bench button

    Hi Thank you for your reply.

    I have tried setting enable rule, but either the doesn't show at all or it shows all the time.

    I have added valueRule in Enable Rules please refer screenshot

    7024.Capture2.PNG

    taqi_checkoutstatus is the lookup name, it has two values Checked In & Checked Out

    I have also assigned this Enable Rule to Command and Command to Button.

    Please Help.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: How to hide/show Ribbon Work Bench button

    Hi,

    Use ribbon workbench enable rule or display rule.

    [View:https://m.youtube.com/watch?v=wUiqaR9TruU]

    [View:https://balugajjala.wordpress.com/2017/01/27/enabledisable-a-ribbon-button-dynamically-based-on-a-form-value]

    [View:http://www.powerxrm.com/how-to-dynamically-enabledisable-ribbon-buttons-based-on-field-values/]

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Dynamics 365 general forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans