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 / Showing buttom dependi...
Power Apps
Answered

Showing buttom depending on the entity's view

(0) ShareShare
ReportReport
Posted on by 35
Hello there!


I'm creating a Model Driven App and I want to show a custom button created on the main grid when I'm in a specific entity's view. For example: If I'm on "View A" the button shows and if I'm on "View B" the button is hidden.

Is this possible?

 

Any help is appreciated

I have the same question (0)
  • AbdulWahab Profile Picture
    517 on at

    Hi @AntonioMF ,

     

    Below are the links that might be going to help you:

    If I answer your question then please mark it as verified.

     

    Let me know if I can provide you with more details.

     

    Thanks
    Regards,

     

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: https://www.linkedin.com/in/abdul-wahab-a5b8b011a/
    Youtube Channel: https://www.youtube.com/channel/UCBjgLqLK_2kU-3bwo4McrTw

  • Verified answer
    Federico Pelliccia Profile Picture
    143 on at

    You could try to use a custom javascript enable rule. You can pass the executionContext (in main grid it should be SelectedControl) to method and call the function

    To pass in the execution context (form context or grid context) information to JavaScript function for your ribbon actions, specify PrimaryControl for the form context, or SelectedControl for the grid context as the <CrmParameter> value in your ribbon definition. SelectedControl will pass in the grid context, for both subgrids and homepage grids. The passed in PrimaryControl or the SelectedControl value is used as an argument in your JavaScript function for form context or grid context respectively.

    Then try this code:


     

     doSomething(SelectedControl ) { 
    var gridContext = SelectedControl
    var viewSelector = gridContext.getViewSelector();
    var gridId = viewSelector.getCurrentView()[0].id // I don't know if it is an array or not
    //If not: var gridId = viewSelector.getCurrentView().id 
    
    // Now write your logic:
    if gridId == 'YOUR_VIEW_ID'{
     return true;
     }
    else{
    return false;
    }

     


    For more information: Pass data from a page as a parameter to Ribbon actions (model-driven apps) - Power Apps | Microsoft Learn


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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 308

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard