cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resolver II
Resolver II

Order of events

Hi,

I have a process on a button select to save a form and then move on to the next command based on the OnSuccess of the form.

 

I Set the value of a label to true or false based on OnSuccess / OnFailure.  This works but the problem is the code in the OnSelect of the button has already moved on and is always seeing the value as the default e.g. false.

 

So it seems the order of events is as follows:

- SaveForm

          - OnSuccess or OnFailure action (this happens during Saving but the OnSelect ahs already moved on to the next step so it is not correct

- Check value and do something

 

What I have done is implement a timer and I set it to 5 seconds then on timer end I run the next steps instead of doing them in the OnSelect button. This works fine - except I have now added time to the action.

 

My question is if this is right or not?  Is there a best practice or would this be considered a bug or how it works?

 

I do not like the idea of adding time to a uses experience by putting timers in - I would have thought all the SaveForm actions should complete prior to moving on to the next step. 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Hi @Gargoolgala,

You haven't specified the particular sequence in the OnSelect property of the SubmitForm button, but I'm guessing that that is where you are putting your second command.   It sounds like it was SubmitForm(Form1); Check value and do something.  The solution is to move the second command (the one in red) to the OnSuccess property of the form.  That way, it won't be executed until the form has been successfully submitted.  Likewise, if you wanted to Check the value and do something else if the form was not successfully submitted, you would put the Check value and do something else in the OnFailure property of the form. If this answers your question, please mark the thread as solved. 

View solution in original post

2 REPLIES 2
Super User II
Super User II

Hi @Gargoolgala,

You haven't specified the particular sequence in the OnSelect property of the SubmitForm button, but I'm guessing that that is where you are putting your second command.   It sounds like it was SubmitForm(Form1); Check value and do something.  The solution is to move the second command (the one in red) to the OnSuccess property of the form.  That way, it won't be executed until the form has been successfully submitted.  Likewise, if you wanted to Check the value and do something else if the form was not successfully submitted, you would put the Check value and do something else in the OnFailure property of the form. If this answers your question, please mark the thread as solved. 

View solution in original post

Drrickryp,

 

thanks for the clarification.   That makes sense. I will try doing what you have stated but the timer is working for now. I will need to switch it over though in case the 5 seconds is not enough e.g. network latency etc.

 

Also I think it is best practice to do what you have stated and put it in the OnSuccess etc. instead of all in the OnSelect which will run through in sequence without waiting for other actions to take place on other forms etc.

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (7,202)