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

update from collection to sharepoint list

ls_Laptop is a sharepoint list and CacheLaptop is a collection 

 

I want the record to be updated once i submit the form

 

I created  a button onselect = submit(Form1)

 

Form1 onsuccess = ClearCollect(CachedLaptop,Patch(ls_Laptop,CachedLaptop))

 

But this always show error conflict, actually i just want to update the selected or the modify record to the sharepoint list and also the collection. 

 

any idea? Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
daviddraper2
Level: Powered On

Re: update from collection to sharepoint list

I had this same issue.

 

I think that Microsoft Flow and Sharepoint Workflows running can cause this error.

 

 

View solution in original post

10 REPLIES 10
Eickhel
Level 8

Re: update from collection to sharepoint list

Hi,

 

Why don't you simply update the collection after the update? the conflict might be because your saving the data through the form and Patch is also saving the same data.

 

There might be another option if you only use Patch as it returns the updated record when you use it:

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

"The return value of Patch is the record that you modified or created. If you created a record, the return value may include properties that the data source generated automatically."

kelvinyeong
Level: Powered On

Re: update from collection to sharepoint list

Actually due to performance issue, i loaded the sharepoint list into collection onstart, i dont know whether is this the correct way.

 

even my form data are from collection

 

do you mind to give an example on this? i try many ways, maybe i just misunderstood or how the patch work.

 

thanks

Eickhel
Level 8

Re: update from collection to sharepoint list

Keep in mind that the OnStart method is having some issues at the moment.

 

About Patch, you could see this video from @Shanescows that explains it very well:

https://www.youtube.com/watch?v=gX5q_V3U8-s

 

About loading the list into a collection, it depends on what you're trying to do and the size of this list.

Community Support Team
Community Support Team

Re: update from collection to sharepoint list

Hi @kelvinyeong,

 

Could you please share a bit more about the error message that you mentioned?

Do you want to update the modified record into the collection (CacheLaptop) when the modified record is submitted into your SP list?

 

If you want to update the modified record into the collection (CacheLaptop) when the modified record is submitted into your SP list, I think it is not necessary to use the Patch function.

 

I have made a test on my side, please take a try with the following workaround:5.JPG

 

 

Set the OnStart property of the first screen to following formula:

ClearCollect(CachedLaptop,'20180622_case1')

Note: The '20180622_case1' represents the SP list data source within my app.

 

On your side, it is:

ClearCollect(CachedLaptop,ls_Laptop)

Within Edit Screen, set the OnSelect property of the Submit button (Button control) to following formula:

SubmitForm(Form1)

Set the OnSuccess property of the Edit Form control (Form1) to following formula:

Refresh('20180622_case1');ClearCollect(CachedLaptop,'20180622_case1')

On your side, it is:

Refresh(ls_Laptop);ClearCollect(CachedLaptop,ls_Laptop)

In addition, if you want to update the modified record into the Collection (CachedLaptop), you could also take a try to set the OnSuccess property of the Edit Form control (Form1) to following formula:

Refresh(ls_Laptop);UpdateIf(CachedLaptop,ID=Form1.LastSubmit.ID,Form1.Updates)

 

 

More details about the UpdateIf function in PowerApps, please check the following article:

UpdateIf function

 

 

Best regards,

Kris

 

 

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.
KroonOfficeSol
Level 10

Re: update from collection to sharepoint list

Hi @kelvinyeong,

 

One addition to the post off v-xida-msft, who explaines very well how to address this question. You should think what you're triïng to achieve by collection in this way instead off just connecting to your datasource? 

 

The main problem in your approach is that at a specific moment in time you will run into a limitation issue related to the max nummer off records you can store in a collection. Default this limitation is 500 (you can max set it to 2000 in the advance menu) so when you hit this number off records the ClearCollect() will not contain your new update records, simple because only the first  number off records are imported.

 

If you want to use the collection then at least add a condition to it to be sure the new records are loaded. For example a 

SortByColumns(datasource, Createdate, Descending)
kelvinyeong
Level: Powered On

Re: update from collection to sharepoint list

@v-xida-msft Hi Kris, I used this method before and it intermitently gave me ETAG Mismatch error as screenshot below, that why i'm trying patch, but seem like i facing the same issue also, can't find out what wrong with that.

 

0490d87a-d509-43fa-b1a8-e349175f649c.jpeg

kelvinyeong
Level: Powered On

Re: update from collection to sharepoint list

@KroonOfficeSol the reason why I used collection instead sharepoint list directly

 

1) If get sharepoint list directly, the gallery take time to load even with few records, not to talk about 1k records, of cause I will filter with some condition to get it less records, but just the screen with gallery can load faster if i get from collection instead of direct sharepoint list

 

2) it effect the smoothness on mobile while using powerapps, I try on a mid range phone, I can't expect everyone get an iPhoneX for this. 

daviddraper2
Level: Powered On

Re: update from collection to sharepoint list

I had this same issue.

 

I think that Microsoft Flow and Sharepoint Workflows running can cause this error.

 

 

View solution in original post

kelvinyeong
Level: Powered On

Re: update from collection to sharepoint list

oh god, you save me! that was really issue due to microsoft flow, i have a flow that auto update field if modified, so what i do is disable the field to be submit from powerapps and it work! thank you so much.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

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
Users online (6,108)