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

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (22,364)