Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Unable to Access Global Variable , and state in Button Click Function

(0) ShareShare
ReportReport
Posted on by 8

Hi,

I am trying to access one of the global collections from a button click function. I have a requirement to show a detail list based on button click. On button click i need to show inactive records otherwise i should show active records on a list. 

 

I am able to show Active records , however not sure how to do the button click functionality. In the button click event i am unable to access any global variables or collections including state. Please suggest, i am using office react ui controls.

  • Hemant Gaur Profile Picture
    on at
    Re: Unable to Access Global Variable , and state in Button Click Function

    @pradeepperi wrote:

    Hi,

    I am trying to access one of the global collections from a button click function. I have a requirement to show a detail list based on button click. On button click i need to show inactive records otherwise i should show active records on a list. 

     

    I am able to show Active records , however not sure how to do the button click functionality. In the button click event i am unable to access any global variables or collections including state. Please suggest, i am using office react ui controls.


    Hard to understand without looking at the code. Can you please share control with minimal code where this can be reproed. Given the function scopes,  you might need to store it locally and pass into the functions needing it. 

  • abecerra Profile Picture
    58 on at
    Re: Unable to Access Global Variable , and state in Button Click Function

    Try using Set(<variablename>,<value>). I had better luck with this that creating a collection, saving it and the retrieving the first collection. It works better with set. Best of luck

  • Sheldon Copper Profile Picture
    200 on at
    Re: Unable to Access Global Variable , and state in Button Click Function
    Are you giving click event like this
    this._btnUpdateLatLong.addEventListener("click", this.updateRecord.bind(this));
     
    In updateRecord, I am accessing all global variable through this keyword eg this.VarName

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 87 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 67 Super User 2025 Season 1

Overall leaderboard