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

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,989 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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard