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 / get control name in On...
Power Apps
Answered

get control name in OnSelect

(0) ShareShare
ReportReport
Posted on by 30

Hi,
Is it possible to get Control name string value in events like OnSelect?

So if there is a control named "Button1", in "OnSelect" I would write something like:
Set(ThisButtonName, Me.Name);

For debugging purposes, I am trying to log which button was pressed,
and I do not want to hard-code button names.


Thanks in advance.

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @arisima 
    There is no way for a button or any other control to reference 'Self' to get this information.  You must hardcode it.

     

    Suggest you go vote for the Idea right now!  Microsoft is reviewing this feature request and if it gets enough votes it will be introduced into PowerApps.

     

    Link To Idea Page:

    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Ability-to-reference-items-in-a-control-using-quot-Self-quot/idi-p/143093

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • KrishnaV Profile Picture
    5,023 on at

    Hi @arisima ,

     

    As @mdevaney said, unfortunately, there is no way in powerapps to implement this behavior I can see that you are a traditional .Net developer. However, since you said that it is for debugging purpose what you can do is:
    onScreen visible: updatecontext{varBtnSelected:""} and bind/show this variable to a label. Now on each and every button update the context of the variable with the button name as updatecontext{varBtnSelected:"Add Item Button clicked "} or updatecontext{varBtnSelected:"Edit Item button clicked"}.

     

    So that will automatically update the label value and will give you a better picture for your debugging. Hope this helps.

     

    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

    Regards,
    Krishna

     

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
Haque Profile Picture

Haque 94

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard