cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
grodinsm
Level: Powered On

Save form without leaving OR patch onchange without refreshing

Hello, new Powerapps user here trying to build my first app, it seems perfect for our uses but I can't get past this one issue.

 

I have a form I'm building that will have a lot of data cards. My users are uncomfortable with the idea of only clicking "save" at the end after spending over an hour filling out the form with a client. I have done a lot of searching and can't find any solution to my issue.

 

My data comes from the database partially filled out, and then we will use this form to update anything that is entered incorrectly, and add a lot of new information. 

 

I have a save button set to : UpdateContext({FormDisabled: true}); SubmitForm(Form1);UpdateContext({FormDisabled: false})

 

this works, but when the form is enabled again, all of the fields are reset to the information they contained when the page was first opened from the gallery. The database is updated correctly, but seeing all of that information disappear will terrify the users. Clicking back, waiting a few seconds, and then selecting the item again will present the correct data. 

 

I have tried running patch inside of a textbox on change, so that it would save as they go. my code works, but again, once the patch is complete, the textbox displays the original content. 

 

patch code: Patch('[dbo].[Opportunity]',First(Filter('[dbo].[Opportunity]',AccountId=displayItem.AccountId)),{Convert_Street__c:Convert_Street__c})

 

I even tried having the save button incorporate a Back command, and then a Navigate command back to the current item, but that doesn't work. you can see the blue dots doing their work across the top. if the navigate command fires before powerapps refreshes the dataset, it gets the old set of data. 

 

help!

 

I am connected via the "cloud services" option to an on-premises SQL server.

 

I am ok with having the "Save" command display a spinning wheel or and waiting until the DB refresh is complete, if that's possible. 

 

I was thinking maybe when the patch runs, on each textbox, I could patch the data to a variable in memory, then patch to the DB, and then pull the data back to the textbox from the variable. But I can't figure out how to do that. 

 

I'm also ok with Save running on a timer / "Autosave" and just having it quietly save the data in the background without affecting what the user sees on screen. This would be ideal. I could set the SubmitForm to run on a timer, but again, the screen would refresh and show the user the original set of data. 

1 REPLY 1
grodinsm
Level: Powered On

Re: Save form without leaving OR patch onchange without refreshing

Update: For anyone who ever has this issue and couldn't find a solution, hopefully you find this thread. 

 

I did not have this app auto-generated for me, because I plan on using it mostly on a desktop and needed a 3 column design. I created the form first, and then manually made the gallery later. 

 

The form was generated for me with an Item property of "displayItem" however if you follow along with the powerapps tutorials it suggests that it should be set to the galleryname.selected (in my case TemplateGalleryList1.selected)

 

After doing this, submitForm works, the screen shows the old data for a second or two, but then the fields show the correct, new data after a few seconds. 

 

The Code above I listed for Patch does not play nicely with this change, as it still references displayitem.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,959)