I have a collection that stores multiple records for update. I use a ForEach / Patch combo tied to the OnSelect property of a Button, and it works... kinda.
The list I'm updating has a unique-required field index field (RMT_EID), and some other fields (one left as an example). When I try to update multiple records, I get an error for adding a duplicate record, for all of the records EXCEPT the last. The LAST changed record DOES work. It's not related to the data, as it is the same outcome regardless of which record is last.
The intent is to update the 'R1 Tower Lead EID' field for existing records, not to add anything. I added the 'RMT_EID' field to the Patch to fix an issue where the records were not updating at all... and it fixed that, but seemed to break something else. Thoughts?
Code is:
ForAll(
RenameColumns(Filter(collMultiUpdateChanged, IsChanged),"ID","GalleryID"),
Patch(listName, LookUp(listName,ID=GalleryID),
{ 'RMT_EID': Resource_1.Text,
'R1 Tower Lead EID': TowerLead_1.Selected.Value }
)
)
By the way @ShaneYoung has an excellent video on updating multiple records (https://www.youtube.com/watch?v=0xZ4fMJbLvk) and I highly recommend you check him out!