Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Ribbon Work Bench: Show Hide Custom Button Based on Views

Posted on by 330

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.

  • Community Member Profile Picture
    Community Member Microsoft Employee 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).

  • lawix10 Profile Picture
    lawix10 330 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?

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee 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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans