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

Submit Form / Patch Sharepoint Item and Reload form

Hi Everybody,

I've an headache with my Demand PowerAPP

Scenario

APP with Sharepoint lists as datasource

 

  1. User create a new Item
  2. Fill information on Form
  3. Save Item (and remain on the same page)
  4. set some control on the same page

Some controls are disabled until the item is saved ( ID of sharepoint item=  is not blank, this because i use the Sharepoint ID as key for patching from those controls)

Issue

Patch function save the item on Sharepoint, but the form doesn't reload and as result the ID remains blank

 

Which is the best way to reload the form?

I tried use some workaround (refresh + form.lastsubmit) as seen in some post, but no luck. Does anybody has a better solution?

 

thanks

federico

 

 

 

 

 

3 REPLIES 3
Super User
Super User

Re: Submit Form / Patch Sharepoint Item and Reload form

@Fedo29 

Is it just the ID you need?  You have that available on the form.LastSubmit.ID

However, you randomly mentioned "Patch" in your question.  How are you using Patch?  

If you SubmitForm(yourForm), you will have a yourForm.LastSubmit.ID

If you are Patching your data back, then you will need to grab the ID yourself.  This can be done similar to this:

   UpdateContext({patchedRecord: Patch(yourDatasource,....all your patch formula...})

After that, patchedRecord will have your entire record, including the ID.

 

Hope this helps with the headache.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Fedo29
Level: Powered On

Re: Submit Form / Patch Sharepoint Item and Reload form

@RandyHayes  thanks for response!

 

Well at the moment i use patch function to create the item on Sharepoint List ( before i used submit but it seems not working for my scenario)

I successfully patch the item on the Sharepoint List, but even if the item has been created oand an ID has been generated on Sharepoint List, the ID Datacard on Powerapps form remains blank ( seems like the form doesn't reload after patch). 

This results in control been disabled for the user ( If the user change page and select the item from the home page gallery, the form has the ID populated and the control are enabled)

 

As you know is there a way to somehow reload the form with current item?

thanks

federico

Super User
Super User

Re: Submit Form / Patch Sharepoint Item and Reload form

@Fedo29 

So let's roll back to where you got into trouble with the SubmitForm in the past.  Even for challenging data, this method usually works and should be used when possible (SO much is done for you in that function that you don't have to worry about).

 

ID...why have it on the Edit form?  You should avoid ever changing or otherwise altering the ID...and thus, displaying it should only be for troubleshooting purposes in most cases.

 

The point being though, it seems like, in the past, you were trying to SubmitForm and somehow use the ID that was in the Form to do something else and found that the ID value was not responding how you like (which is most likely true considering the steps that SubmitForm does).  You would really need to be going from NewForm mode to ViewForm mode or Edit and supplying the record from your LastSubmit...which you can do, but it still makes me wonder if that is where you are having the problem or someplace else.

 

SO...now, armed with the knowledge that Form.LastSubmit.ID is in fact the only ID you need for your new record, how does that change the way you might look at this problem now?

In other words...is it possible to get you back to SubmitForm rather than customized formulas to do the same?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,315)