Skip to main content

Notifications

Community site session details

Community site session details

Session Id : owZ/koUarNizlcSLhCwHL9
Power Apps - Building Power Apps
Answered

Custom Button on Subgrid when record is selected

Like (0) ShareShare
ReportReport
Posted on 13 Mar 2023 17:36:56 by 9

Hi everyone. I have a model-driven application that leverages the Power Apps Grid Control for subgrids on a form. I know how to create a custom button with the command bar editor, and have done so multiple times. What I am trying to accomplish right now is when a user selects a record in the subgrid I want to display a custom button to allow the user to clone that record. When you select the record, a different menu of buttons shows up. Is there a way (using JavaScript or otherwise) to intercept that and display my own button?

 

 

  • AG2019 Profile Picture
    25 on 07 Feb 2024 at 14:48:58
    Re: Custom Button on Subgrid when record is selected

    @SBax Found what is going wrong here. In modeldriven app you can edit/add commands, here you can select show/formula. If you are at your table and add a command, it's not available.

     

    Though: The command direct from table shows up as long as I don't select a record in subgrid, the one from the modeldriven app doesn't. Looking in that now

  • SBax Profile Picture
    1,348 on 07 Feb 2024 at 14:41:13
    Re: Custom Button on Subgrid when record is selected

    This seems like a possible bug, let me try and replicate in my environment and come back to you later

  • AG2019 Profile Picture
    25 on 07 Feb 2024 at 14:29:33
    Re: Custom Button on Subgrid when record is selected

    AG2019_1-1707316141921.png

    Only show is available

     

  • AG2019 Profile Picture
    25 on 07 Feb 2024 at 14:27:17
    Re: Custom Button on Subgrid when record is selected

    That's what I indeed expected, but can't find a way to change it. Changing it can be done for forms, but in my situation not on subgrid

  • SBax Profile Picture
    1,348 on 07 Feb 2024 at 14:09:07
    Re: Custom Button on Subgrid when record is selected

    Hi @AG2019 - if you change the value of visibility to "formula" then you can enter the countries function I detailed above 

  • AG2019 Profile Picture
    25 on 07 Feb 2024 at 14:01:15
    Re: Custom Button on Subgrid when record is selected

    Hi @SBax ,

     

    Looking for the same solution I read your response and was wondering what you mean with " to do your cloning and set a visibility rule"?

    In the new editor I don't see an option to set visibility rule? Only that the button will be shown as long as no row is selected in the grid (displayed when "i" is clicked)

    AG2019_0-1707314406976.png

     

  • gbundy Profile Picture
    9 on 15 Mar 2023 at 02:57:53
    Re: Custom Button on Subgrid when record is selected

    I can't believe it was that simple! Thank you so much @SBax . Marked as solution!

     

    P.S. - Bonus points if you can tell me why I can't Patch(Notifications in my Model-Driven app to create an in-app notification lol...

  • Verified answer
    SBax Profile Picture
    1,348 on 14 Mar 2023 at 22:56:08
    Re: Custom Button on Subgrid when record is selected

    You could create a new button on the subgrid view in the modern command editor to do your cloning and set a visibility rule on the new button to either :

     

    CountRows(Self.Selected.AllItems) = 1 //(only visible if a single row is selected)

     

    Or 

     

    CountRows(Self.Selected.AllItems) > 0 //(visible if one or more rows are selected)

     

    Does this cover what you need?

     

    Feel free to drop any additional questions in a reply

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard