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 / Save action removes re...
Power Apps
Answered

Save action removes record in input gallery

(0) ShareShare
ReportReport
Posted on by 443

I posted a similar problem before (https://powerusers.microsoft.com/t5/General-Discussion/Save-action-removes-part-of-record-in-input-gallery/m-p/284409#M82348).  However it's a bit different.  Instead of removing part of the record, it removes the entire record.  Now, the fix last time was to change the command from Patch to Update.  Also, in the older post, it was writing to a new/empty collection.  In this case, it's writing to a SPO list.  Not sure if that makes a difference, but feel I should mention it.  I have also tried the fix from last time, and it doesn't work.  So, here is the code from the app's OnStart:

 

ClearCollect(col_AllRequests, SortByColumns(RequestsForm, "ID", Ascending));

ClearCollect(col_AllItems, SortByColumns('Item List', "ID", Ascending))



The code from the edit screen's OnVisible property:

 

Set(var_SharepointSelectedID, SharePointIntegration.SelectedListItemID);

UpdateContext({var_RecordCheck: LookUp(col_AllItems, SharePointIntegration.SelectedListItemID in 'Request ID')});

ClearCollect(col_ItemDetailEdit, ShowColumns(Filter(col_AllItems, var_SharepointSelectedID in 'Request ID'), "ItemName", "ItemDescription", "ItemQuantity","ID", "Title"))

 

 

The code from the SharePointIntegration -> OnSave property:

 

If(SharepointFormMode="CreateForm", SubmitForm(RequestFormNew), SubmitForm(RequestFormEdit))

 

 

Here is the code from the Save icon/button:

 

UpdateContext({var_RecordCheck2:ThisItem.ID in col_ItemDetailEdit.ID});
UpdateContext({var_RecordCheck3:!IsBlank(Last(col_ItemDetailEdit).ItemName)});
Update(col_ItemDetailEdit,ThisItem,        {Title:ThisItem.Title,Item:EditItemVal.Text,Description:EditDescripVal.Text,Quantity:Value(EditQuantityVal.Text)});
If(var_RecordCheck3,
Collect(col_ItemDetailEdit, {Item:"",Description:"",Quantity:0}));
If(var_RecordCheck2,
Patch('Item List',LookUp(col_AllItems,ID=ThisItem.ID),{'Item Name':EditItemVal.Text,'Item Description':EditDescripVal.Text,'Item Quantity':Value(EditQuantityVal.Text),'Request ID':var_SharepointSelectedID,Title:SharePointIntegration.Selected.Title}),
Patch('Item List',Defaults('Item List'),{'Item Name':EditItemVal.Text,'Item Description':EditDescripVal.Text,'Item Quantity':Value(EditQuantityVal.Text),'Request ID':var_SharepointSelectedID,Title:SharePointIntegration.Selected.Title}))

 

Any help is appreciated.

 

Categories:
I have the same question (0)
  • Verified answer
    lumberjacklurch Profile Picture
    443 on at

    Nevermind, I fixed it.  I wasn't refreshing the collection that gallery was pulling from, so I used ClearCollect to re-initialize the collection, and now any record's change is reflected in the gallery.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard