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 :
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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard