cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gargoolgala
Level 8

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
Super User

Re: Order of events

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
Super User

Re: Order of events

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

Gargoolgala
Level 8

Re: Order of events

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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