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

How to execute "Run OnStart" step while variable value changes

Hi Team,

 

I have created a boolean global variable on start of app and updating the value of that variable with a textbox on another screen.

 

However, when I change the value, it needs a trigger of "Run OnStart" to update the variable value.

 

There's an admin who have access to that screen and can update the value and that value should remain intact inside the app for others.

 

variable on start of app

Set(
    isEnabled,
    TextBox2.Value
);

 

Is there any alternative way to fix this? Can I refresh the app with Refresh() function? 

 

Really appreciate any help with this!

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Divya_R ,

 

There is no way to execute OnStart during App running, unless you close and open the App again.

 

The point is, OnStart is one of all those On... properties that could use to append behavior formulas in Canvas Apps. Any formulas that in OnStart could also use in the other properties like OnSelect/OnChange/OnVisible/On... to execute again, only need to copy and paste. On... properties means when... to execute something, no doubt that you could use the same formulas in different places to do a same thing.

 

Below is the doc about behavior formulas for reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-formulas-in-depth

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

10 REPLIES 10
RandyHayes
Super User
Super User

@Divya_R 

I am not sure what the purpose of your formula is in this case.  You are referencing a .Value property of a textbox...that control doesn't have such a property!

 

Can you expand on that?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes,

 

Thanks for your quick response. 

 

I don't see .Text property of textbox and there's only .Value

Divya_R_0-1634764931059.png

 

 

 

 

RandyHayes
Super User
Super User

@Divya_R 

Then it is not a text input control.  Instead of looking on that side of the screen, look at the property pane on the right side and send a screenshot of that.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes ,

 

PFB,

 

Divya_R_0-1634765293437.png

 

RandyHayes
Super User
Super User

@Divya_R 

Ah, you're not in a canvas app, you're in Teams!

 

So, your initial formula seems to indicate that your isEnabled variable would be a true or false value, but apparently you are setting it to what ever text is typed into that textinput control.

 

If all of that is the case, then just set the OnChange action of the Textinput control to:

Set(
    isEnabled, Self.Value
);

This will update your variable.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Divya_R
Frequent Visitor

Hi @RandyHayes,

 

I tried, but seems there's an incompatibility issue. 

 

TextBox - OnChange 

 

Set(
      isEnabled, Self.Value
);

 

and on start of app

Set(
    isEnable, Texttbox.Value
)

 

Divya_R_0-1634765959414.png

 

However, I got it working with Toggle and directly using Toggle.Checked in on start of app.

 

Set(
   isEnable, Toggle.Checked
);
RandyHayes
Super User
Super User

@Divya_R 

Well, that was where I was heading - you originally said it was a boolean variable, but you were setting it to the text of the text input control - not a boolean value.

If you use a toggle, that will be boolean.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes,

 

I get it. Thanks so much 🙂 

 

But is there any way to refresh the app which triggers "Run OnStart" job? so as soon as I update the variable it refreshes the value on start of app?

Hi @Divya_R ,

 

There is no way to execute OnStart during App running, unless you close and open the App again.

 

The point is, OnStart is one of all those On... properties that could use to append behavior formulas in Canvas Apps. Any formulas that in OnStart could also use in the other properties like OnSelect/OnChange/OnVisible/On... to execute again, only need to copy and paste. On... properties means when... to execute something, no doubt that you could use the same formulas in different places to do a same thing.

 

Below is the doc about behavior formulas for reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-formulas-in-depth

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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