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 / use the text of a butt...
Power Apps
Answered

use the text of a button as a Patch() function argument

(0) ShareShare
ReportReport
Posted on by 413

Hi guys. 

 

I have to built different buttons with almost the same code. 

Every button create a record in my list with patch() function, I'm just looking for a code that I can paste without wating time modifing it everytime. 

 

Actually, the code is:

 

Patch('Segnalazione eventi macchina';Defaults('Segnalazione eventi macchina');{Linea: "T6";Evento: "Raccolta";Inizio: Now()});;

 

But i'd like to have something more standardized to create the "evento" value, such as:

 

Patch('Segnalazione eventi macchina';Defaults('Segnalazione eventi macchina');{Linea: "T6";Evento: Button.text;Inizio: Now()});;

 

Actually I don't know if this is possible, just wait for your suggestions 🙂

Categories:
I have the same question (0)
  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    Hello @Calcioscacchi ,

     

    "Self" allow you to directly call the control parent where your code is being called.

     

    By using "Self" instead of directly referencing your button, you will eventually save a lot of time instead of rewriting them one by one.

     

    For example, in your "OnSelect" of your button, you can write the following code:

     

    Notify(Self.Text)

     

    This code will display a notification showing the text of your button everytime you press it. 

     

    Unfortunately, I don't think there is a method to get the control's name, so I hope the button's text will do for you.

  • Calcioscacchi Profile Picture
    413 on at

    It does. 

    Patch('Segnalazione eventi macchina';Defaults('Segnalazione eventi macchina');{Linea: "T6";Evento: Self.Text;Inizio: Now()});;

     

    Works perfectly 😉

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 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard