I have a block of code where I set a variable to an initial value, followed by a number of SubmitForm() functions in a row. I change the variable's value in the OnSuccess/OnFailure of the forms, and once the SubmitForm() functions are done, I run an If-else block based on the value of the variable. However, it seems that the OnSuccess/OnFailure of the SubmitForm() functions run parallely to the code that comes after it, since the variable remains the initialized value that I set before the SubmitForm() functions. I verified this by running a simple increment counter on success, and triggered a success, to see what executes first (or simultaneously), and it reconfirmed my suspicion.
The main code block is:
Set(AttachmentFailureLog, Blank());
Set(LoadingOverlay, true);
SubmitForm(Form1);
SubmitForm(Form2_9);
SubmitForm(Form2_10);
SubmitForm(Form2_11);
SubmitForm(Form2_12);
SubmitForm(Form2_13);
SubmitForm(Form2_20);
If(IsBlank(AttachmentFailureLog),
//success code
,
//failure code)
___________________________________________________________________________________________________________________________________________
The OnFailure of the first form is :
Set(isEditable, false);
Set(LoadingOverlay, false);
Notify("There was an error submitting the request, please contact admin", NotificationType.Error);
Set(AttachmentFailureLog,"Request resubmit failed at "&Now())
___________________________________________________________________________________________________________________________________________
I forced a failure and got the appropriate notification, but the If-else block executed the code that is supposed to run on AttachmentFailureLog being blank.
My question is how do I perform a workaround so that the next part only runs once all the SubmitForms OnSuccess/OnFailure codes have finished running?