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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Hide/Show Button on a specific Model Driven App

(0) ShareShare
ReportReport
Posted on by 1,848

Hi All,

I have multiple Model Driven Apps but I want to show a custom button on a specific Model Driven App on Activities and hide all other buttons.

How can I achieve this using Ribbon Workbench?

How can I get the app name and show/hide the button accordingly?

I have the same question (0)
  • Suggested answer
    StefanS365 Profile Picture
    3,575 Most Valuable Professional on at

    Hi M,

    Here is an example of how to do that with the help of the Ribbon Workbench:

    butenko.pro/.../

  • MNarmeen Profile Picture
    1,848 on at

    Thanks, I was following the same link but the button appears on the form and it gets formcontext to hide/show. But in my case the button is on the Home.Grid view and need globalcontext.

    I am not sure how to pass Globalcontext in CRM parameters in Enable Rule.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    You can use below to get the global context and check the App properties-

    =====

    var globalContext = Xrm.Utility.getGlobalContext();

    globalContext.getCurrentAppProperties().then(successCallback, errorCallback);

    ======

    docs.microsoft.com/.../getcurrentappproperties

    Hope this helps.

  • MNarmeen Profile Picture
    1,848 on at

    Hey Ravi,

    I already tried that but I don't get the app name.

    AppName.PNG

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    Can you try below code-

    =================

    var AB = AB || {};

    AB.Ribbon = (function () {

       //defaulting button visibility and promise completion to false

       var isButtonEnabled = false;

       var isPromiseCompleted = false;

       function IsButtonEnabled(formContext, appUniqueName) {        

           var appName;

           var globalContext = Xrm.Utility.getGlobalContext();

           globalContext.context.getCurrentAppProperties().then(

               function (appProperties) {

               appName = appProperties.uniqueName;

           },

               function (error) {

                   appName = "";

           }

           );

           alert(appName);

       }

       return {

           IsButtonEnabled: IsButtonEnabled

       };

    })();

    =======================

  • MNarmeen Profile Picture
    1,848 on at

    Can anyone please let me know how to refresh HomeGrid ribbon on Javascript?

  • Yasaswini Uppala Profile Picture
    30 on at

    Hello,

    Have you achieved this functionality? If so, could you please let me know the correction you made as I m trying to implement the same.

    Thanks!

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

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 183 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 110

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 61 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans