cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pradeepperi
Frequent Visitor

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

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.

3 REPLIES 3
sheldoncopper73
Resolver I
Resolver I

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
Helper II
Helper II

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

HemantG
Power Apps
Power Apps


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

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Users online (2,095)