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 / Unable to Access Globa...
Power Apps
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.

I have the same question (0)
  • Sheldon Copper Profile Picture
    200 on at
    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
  • abecerra Profile Picture
    58 on at

    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

  • Hemant Gaur Profile Picture
    Microsoft Employee on at

    @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. 

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 463

#2
WarrenBelz Profile Picture

WarrenBelz 364 Most Valuable Professional

#3
11manish Profile Picture

11manish 275

Last 30 days Overall leaderboard