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

Form Navigation - use of LastSubmit and issues related to delay in form submission

Hi, 

 

I am currently trying to adapt one of my apps following the steps in this thread. 

 

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/After-SubmitForm-Gallery-Selected-j...

 

This allows me to use a separate variable/ record for edit and detail screen form items, which in theory should prevent any issues with the form jumping to the wrong record. 

 

This works really well, however I have found when the form takes a while to submit I can still navigate to the wrong record as the editItem variable doesn't update quick enough using the LastSubmit function of the form. 

 

What would be the best practice to avoid this from happening? Is there a way to create a loading icon/ screen until the form submission is complete and the variable is updated? Is there a way to lock out the other navigation icons in the meantime until this process is complete? 

 

Any advice would be greatly appreciated, as this is a major annoyance in all my apps. 

 

Thank you for your help in advance! 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Form Navigation - use of LastSubmit and issues related to delay in form submission

Hi @GamerGirl123 ,

Based on the formula that you provided, I found that you use context variable to store the current item selected from your Gallery.

 

As an alternative solution, please consider store the selected item in your Gallery into a globla variable. Then use the global variable within your app everywhere.

 

Set the OnSelect property of the "Next" arrow to following:

set(displayItem, ThisItem);
Navigate(AttributeAssDetailScreen, None)

Then you use the global variable displayItem everywhere in your app.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: Form Navigation - use of LastSubmit and issues related to delay in form submission

Hi @GamerGirl123 ,

Could you please share a bit more about your scenario?

How do you update the editItem variable within your app? Could you please show more details about the formula you used in your app?

 

Based on the issue that you mentioned, I have made a test on my side. Please consider take a try with the following workaround:

Set the OnSuccess property of the Edit form to following:

Set(SubmittedRecord, EditForm1.LastSubmit); // store the submitted record into a global, then you could use it anywhere in your app 
Navigate(AnotherScreen)

Note: The OnSuccess property would be fired only when your form data submitted successfully..

Within your another screen, you could reference the column value of the previous submitted record via the SubmittedRecord variable.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Form Navigation - use of LastSubmit and issues related to delay in form submission

Hi @v-xida-msft,

 

Thank you for your help in trying to sort this out> It is greatly appreciated.

 

A bit more info as requested:

My app uses the standard layout of Browse screen, Detail Screen and Edit Screen and allows the user to fill in Feedback forms/ attribute assessments.

 

The code used is as follows:

Browse Screen:

Next arrow in the Gallery:

Navigate(AttributeAssDetailScreen, None, {displayItem:ThisItem, DisplayItemID:ThisItem.ID})

 

Detail screen:

FromViewer item property is set to displayItem

 

Delete code:

Remove(Feedback, displayItem); If (IsEmpty(Errors(Feedback)), Back()) 

 

Edit Code:

EditForm(EditForm2);Navigate(AttributeAssEditScreen, ScreenTransition.None, {editItem:displayItem}) 

 

Edit Screen:

Editform2 Item property set to editItem

OnSuccess property code:

Navigate(AttributeAssEditScreen, ScreenTransition.None, {editItem: EditForm2.LastSubmit, editItemID: EditForm2.LastSubmit.ID}); Refresh(Feedback) 

 

X-Icon:

If (EditForm2.Mode = New, ResetForm(EditForm2) & Navigate(AttributeAssBrowseScreen, None), Navigate(AttributeAssDetailScreen, ScreenTransition.None, {DisplayItem:EditForm2.LastSubmit}) & ResetForm(EditForm2)) 

 

The code works fine as such, but I find the LastSubmit function is too slow resulting in a multitude of issues:

- The user can navigate away from the edit screen after a new form has been created while the OnSuccess Property hasn't fired yet - results in navigation to the wrong record or a record error for editItem

 

-The user can navigate away from the edit screen when the OnSuccess property hasn't fired yet for an updated form - the record data held in editItem and displayItem is out of date and will display data from an older submission not the most recent one

 

Could you please provide any suggestions on how to deal with this situation? Is it better to work with the ID value only and then update the record from the data source on a different trigger? Can this issue be controlled via introduction of a loading screen or conditioning the visibility of the x-icon to the OnSuccess property of the form?

 

I have the same problem on a few similar apps so getting this fixed would really help me out massively.

 

Thank you

Highlighted
Community Support
Community Support

Re: Form Navigation - use of LastSubmit and issues related to delay in form submission

Hi @GamerGirl123 ,

Based on the formula that you provided, I found that you use context variable to store the current item selected from your Gallery.

 

As an alternative solution, please consider store the selected item in your Gallery into a globla variable. Then use the global variable within your app everywhere.

 

Set the OnSelect property of the "Next" arrow to following:

set(displayItem, ThisItem);
Navigate(AttributeAssDetailScreen, None)

Then you use the global variable displayItem everywhere in your app.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: Form Navigation - use of LastSubmit and issues related to delay in form submission

Hi @v-xida-msft,

 

Thank you for your reply - changing over to a global variable has fixed the issue.

Wouldn't have guessed that the variable classification was what caused my app to fall over.

A very big thank you for finding a solution to my problem  🙂

 

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,884)