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

Community site session details

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

Ribbon Work Bench: Show Hide Custom Button Based on Views

(0) ShareShare
ReportReport
Posted on by 334

Hi Have a requirement to Show Or Hide a custom ribbon work bench based on the view.

The button is on the Home Ribbon and not Subgrid .

I have written the logic for Javascript

function ShowHideCustomButton(selectedCtrl)
{

var viewName = selectedCtrl._getCurrentView();

alert (viewName);


// another method
var viewName2 = selectedCtrl.get_viewTitle();



}

The closest I for was the first variable and it returned object object , IF i can get the view name , my problem is solved.

For the selected control  I used the crm parameter selected control in ribbon work bench.

Am also on the latest crm which is power apps.

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Ribbon Work Bench: Show Hide Custom Button Based on Views

    Hi lawix10,

    _getCurrentView() function can't get the name of view. And get_viewTitle function can't work in the lastest Crm.

    You can use the following code to get viewName:

    function getViewName(selectedCtrl) {
            var viewName = selectedCtrl.getViewSelector().getCurrentView().name;
            alert(viewName);
    }

    And pass the SelectedControl to this function:

    pastedimage1631766043242v1.png

    Result:

    pastedimage1631766271920v2.png

  • lawix10 Profile Picture
    334 on at
    RE: Ribbon Work Bench: Show Hide Custom Button Based on Views

    Perfect Answer , just one question ..on ribbon workbench , in crm parameter , what is the different between SelectedControl and Primary Control?

  • Community Member Profile Picture
    on at
    RE: Ribbon Work Bench: Show Hide Custom Button Based on Views

    Hi lawix10,

    You can refer to this link:CRM Parameters in Ribbon WorkBench for Dynamics 365. – World of Dynamics (wordpress.com).

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 120 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 119

#3
Erin Lubben Profile Picture

Erin Lubben 66

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans