web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Hide Ribbon button using javascript code in crm 365

(0) ShareShare
ReportReport
Posted on by 351

Hello,

i have requirement,overthere i want to hide ribbon button based on filed's value(like if field value has blank then it will visible otherewise it will be hide).

i know it colud be happen through display rule of ribbon(using Value rule).

but i want to do using javascript code only.

Thanks,

regards.

*This post is locked for comments

I have the same question (0)
  • Jorge Gomez Profile Picture
    152 on at

    Hello Yash,

    I highly recommend you to do this making use of the Ribbon Workbench, to do it using javascript code only, you will be forced to make use of unsupported code, accessing the DOM, which is not supported and not recommended by Microsoft.

    "JavaScript developers are used to interacting with Document Object Model (DOM) elements in code. You might use the window.getElementById method or the jQuery library. You are free to use these techniques in your HTML web resources, but they are not supported to access elements in Dynamics 365 for Customer Engagement application pages or entity forms. Instead, access to entity form elements are exposed through the Client API object model. The Dynamics 365 for Customer Engagement development team reserves the right to change how pages are composed, including the ID values for elements, so using the Client API object model protects your code from changes in how pages are implemented."

    docs.microsoft.com/.../use-javascript

  • Suggested answer
    Ammar Zaied Profile Picture
    1,670 on at

    Hi Yash,

    Create a Dialog Short-Cut Ribbon Button

  • Verified answer
    Pawar Pravin  Profile Picture
    5,237 on at

    Hi Yash,

    I believe you could do it using enable rule in ribbon workbench.

    Please refer below code for your reference:

    var Value = Xrm.Page.getAttribute("logicalnameoffield").getValue();

    if (Value == null || Value == "")

    return true;

    else {

    return false;

    }

    To add enable rule for your reference:

    ribbonworkbench.uservoice.com/.../121427-enable-disable-a-ribbon-button-dynamically-based-o

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#2
SA-08121319-0 Profile Picture

SA-08121319-0 2

#2
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans