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

SharePoint custom form - collection caching issue

I'm customizing SharePoint list form using powerapps. I've split the form into multiple screens. In the OnStart event of the first screen I'm initializing collections using ClearCollect. The collections are updated as the user edits the form. I've got custom button to save the form data.

 

Patch('My Form',If(Form1.Mode=FormMode.New, Defaults('My Form'), SharePointIntegration.Selected) ,Form1.Updates,Form2.Updates,Form3.Updates);RequestHide()

 

What I've noticed is that if I create a new item by clicking on "New" from the All items page, save it and then immediately click on "New"again, the collection seems to persist the old data. The ClearCollect on appstart does not seem to clear the collection. However if I refresh the all items page before clicking on New then it works fine. Same happens with edit item also. Is there a way to fix this?

3 REPLIES 3
Community Support Team
Community Support Team

Re: SharePoint custom form - collection caching issue

How about add a clear() function after the patch command?

Patch('My Form',If(Form1.Mode=FormMode.New, Defaults('My Form'), SharePointIntegration.Selected) ,Form1.Updates,Form2.Updates,Form3.Updates);RequestHide();Clear(CollectionName)

Would this be possible in your scenario?

In case of Patch fails, we may consider add an if condition to clear the collection.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Rajesh
Level: Powered On

Re: SharePoint custom form - collection caching issue

Tried that, but doesn't work in my scenario. The issue that I've is I'm initializing the collection on App Start. App Start seems to fire the first time when I create/edit an item. From then on if I immediately proceed to create new item or edit an existing item from the all items page, App start doesn't fire and powerapps seems to remember the old values created first time. However if I refresh the all items page before I proceed to create/edit an item it seems to work fine. It appears the power app is not getting unloaded properly. Steps to reproduce

1. Customize a SharePoint list form

2. In the OnStart event, initialize a collection. - ClearCollect(MyCollection, {ID:1,Value:0,Blank:true}, {ID:2,Value:0,Blank:true})

3. Add 2 dropdowns. In the OnChange event update each record in the above collection

4. Add a gallery to display the collection

5. Publish the app to SharePoint

 

Now from the allitems view, click on New. First time you'll see the gallery displaying collection with empty values. Save the item. Click on New again in the all items view. The form will display the gallery with previously saved values.

EmmitK
Level: Powered On

Re: SharePoint custom form - collection caching issue

Did you manage to resolve this? I am having the same problem with caching..

Helpful resources

Announcements
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

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

Top Solution Authors
Top Kudoed Authors
Users online (5,491)