cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
max81
Kudo Kingpin
Kudo Kingpin

Reuse code with toggle button

Hello together, hello @iAm_ManCat,

 

I'm reffering on this discussion:

https://powerusers.microsoft.com/t5/ .... /Call-code-easy-way-to-reuse-code  

and on this Video:

Youtube Video by Todd Baginski

 

I have problems using this "function" (global variable with toggle button) in Internet Explorer and Edge: In the simulation mode it works, but if I open the App without developing mode, it doenst work.

Also on my iPhone it doesn't work.
In Chrome it works well.

 

The variable is changed, but the toggle button is not "updated" until the screen with the toggle button is getting visible.

I'm confused if I'm the only one with this problem(?).

 

Thanks and best regards,

Max

1 ACCEPTED SOLUTION

Accepted Solutions

@iAm_ManCat @ToddBaginski :

 

Just found this information under another video from Todd:


Trading emails with the PA team about this. I have been provided a workaround for the web player. The workaround is to add a reference to the toggle control on the pages where the toggle control does not exist. To do that easily you can add a label, make it invisible, and set the text property to tglErrorGlobal.Value. I did this and it worked well. Waiting to hear if this is a temporary workaround or not.

For me, the workaround worked.

View solution in original post

10 REPLIES 10
iAm_ManCat
Super User
Super User

Hi @max81,

 

Ah, this used to work in all browsers.. I can confirm that it now does not work for IE/Edge for me either. I can trigger the toggle from another screen, but I have to navigate to the screen that the toggle is on to trigger it [except for in Google Chrome].

 

My initial thought is that it's to do with how the browser is loading the screens and their contents into memory, that the actions are suspended until the screen is visible & the object is loaded into memory & rendered.

 

@ToddBaginski have you noticed that the toggle remote trigger stopped working in IE/Edge?

I was pretty sure this used to work with all browsers.

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


@iAm_ManCat @ToddBaginski :

 

Just found this information under another video from Todd:


Trading emails with the PA team about this. I have been provided a workaround for the web player. The workaround is to add a reference to the toggle control on the pages where the toggle control does not exist. To do that easily you can add a label, make it invisible, and set the text property to tglErrorGlobal.Value. I did this and it worked well. Waiting to hear if this is a temporary workaround or not.

For me, the workaround worked.

View solution in original post


@ToddBaginskihave you noticed that the toggle remote trigger stopped working in IE/Edge?


by the way: also my iPhone / iPad had this problem!

Lars1990
Helper II
Helper II

Hi all,

 

I am also trying to use reusable code using toggle buttons. I want to use it in Powerapps in Teams. I can manage to get the toggle being switched on/off using a button on a different screen but it does not invoke the action behind the oncheck property in the toggle. Is it not working in Powerapps in teams or am I doing something wrong? Did anyone manage to get it working in Powerapps in Teams?

 

KR,

 

Lars

@Lars1990 : My experience so far: depending on the browser/device you are using, the toggle button is switched, but the "on check" properties isn't triggered.
My workaround: use a label on your active screen to show you the actual value of your toggle button. With that, the "on check" properties has been triggered.

@max81  I eventually got it to work. I had to use the classic toggle:

 

Lars1990_0-1629980966983.png

 

And if the toggle has to be switched from another screen  you have to navigate to the screen where the Toggle is placed otherwise it will not run the code.

 

So the code has to look like this:

Set(varRunReusableCode,true);
Navigate('ReusableCodeScreen')

max81
Kudo Kingpin
Kudo Kingpin

@Lars1990 : It should not necessary to navigate to that screen, if you use a label to give you the value of the toggle control back.
But I only have experience with standalone apps and I don't use Teams-Apps so far.

 

I don't understand this please explain this. My side toggle does not work in playing mode across the screen

Ok... thank you now it is work but I have doubt it will work all browser and all mobile

@max81 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,528)