Showing results for 
Search instead for 
Did you mean: 
Advocate II
Advocate II

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?

Community Support
Community Support

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.




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.

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.

Not applicable

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

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,163)