Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

How to hide/show Ribbon Work Bench button

Posted on by Microsoft Employee

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
    gdas 50,085 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
    gdas 50,085 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
    Community Member Microsoft Employee 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
    gdas 50,085 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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans