Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Save action removes record in input gallery

(0) ShareShare
ReportReport
Posted on by 435

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:
  • Verified answer
    lumberjacklurch Profile Picture
    lumberjacklurch 435 on at
    Re: Save action removes record in input gallery

    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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard