web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Form Navigation - use ...
Power Apps
Answered

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

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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-jumps-to-a-new-record-when/td-p/76215

 

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! 

 

Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    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 Power Platform Member Profile Picture
    Microsoft Employee on at

    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

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    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 Power Platform Member Profile Picture
    Microsoft Employee on at

    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  🙂

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 294 Most Valuable Professional

#2
11manish Profile Picture

11manish 210

#3
Valantis Profile Picture

Valantis 169

Last 30 days Overall leaderboard