cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

Save action removes record in input gallery

I posted a similar problem before (https://powerusers.microsoft.com/t5/General-Discussion/Save-action-removes-part-of-record-in-input-g...).  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.

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

1 REPLY 1

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.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 100 members 5,332 guests
Please welcome our newest community members: