web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SharePoint custom form...
Power Apps
Unanswered

SharePoint custom form - collection caching issue

(0) ShareShare
ReportReport
Posted on by 104

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?

Categories:
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    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

  • Rajesh Profile Picture
    104 on at

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard