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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to show & hide rib...
Power Apps
Unanswered

How to show & hide ribbon workbench button based on selected view(viewId) in dynamics 365

(0) ShareShare
ReportReport
Posted on by 23

I have a create a ribbon from ribbon workbench for send mails but I want to display it for few views only how can I achieve that!

I have already created a JS where I am getting view id and based on viewed returning a true or false to ribbon workbench to make it visible.

but the problem is while the user the selecting new view. my JS run to get view id which is getting current view id not the selected view id after it refreshing the records but the ribbon is not displaying but if refresh this for now its will again get current view id (assume for this ribbon should to display ) and it will return true to ribbon workbench for display.

you see it should get selected view viewid not the already open viewid!

How I can I solve this problem thank you !      

Note : I have added this ribbon button in Home as you guys know where we can see our view 

 

 

Code : code in JS and calling it from ribbon workbench from custom rule 

 

function CheckViewId() {

    var viewIdValue = getParameterByName("viewid");
    //GetViewId from Url
     function getParameterByName(name, url) {
         if (!url) url = parent.window.location.href;
         name = name.replace(/[\[\]]/g, '\\$&');
         var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
             results = regex.exec(url);
         if (!results) return null;
         if (!results[2]) return '';
         return decodeURIComponent(results[2].replace(/\+/g, ' '));
     };

    console.log(viewIdValue);

    debugger;

    if (viewIdValue == "51823499-4936-ec11-8c64-000d3ab875f4"){
        console.log("1");
        return true;
    } else if (viewIdValue == "48b866ed-4d36-ec11-8c64-000d3ab875f4") {
        console.log("2");
        return true;
    } else if (viewIdValue == "6d2dc24e-4b36-ec11-8c64-000d3ab875f4") {
        console.log("3");
        return true;
    } else {
        return false;
    };
};
Categories:
I have the same question (0)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard