Hello Power Users,
I have a requirement where I need to update a single column value in all items inside a gallery with a button click that button is out side the gallery. Below is the syntax I tried but didn't work out.
ForAll(MyGallery.AllItems, Patch(MyDataSource, LookUp(MyDataSource, ID = ThisItem.ID), {ColumnNameToUpdate: NewValue}))
Can anyone please help me?
Thanks in advance
hi @KrishR
Let me first explain what the code I shared does.
When you use a ForAll it is giving you a loop of records (because the data in a gallery is records).
To Patch a record, you have to tell the Patch statement, which Record/Row to update.
When you are looping the gallery, ThisRecord is the pointer to that record.
So there is an issue possibly with what you filed in for the rest of the stuff, so if you can please share your code (after I gave it to you).
Then we can chat some more about whats wrong. Also, could you please run it, and when you get the error, can you stop the app and show me where you are hovering and take a screenshot.
Happy to help get you working
If you like my answer, I would really appreciate if you please Mark it as Resolved, and give it a thumbs up, so it can help others
Cheers
Thank You
Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
https://gernaeysoftware.com
LinkedIn: https://www.linkedin.com/in/michaelgernaey
@FLMike ,
Thank you for the help.
I tried and didn't workout some how. When I hover on the database/Dataverse Table the error message says "Invalid argument type (GUid). Expecting a Table value instead"
When I hover on the ThisRecord section it says "The specified column '_ownerid_value' does not exist"
And when I hover on the column I want to update it say "The Specified column 'columnName' doesn't exist". Not sure about this error message when I start typing it showed up in below suggestions and now it says doesn't exist.
Can you please let me know if I'm doing something wrong?
Thanks again for your help
You are really really close
Do this
ForAll(MyGallery.AllItems,
Patch(MyDataSource, ThisRecord,
{
ColumnNameToUpdate: NewValue
}
)
);
If you like my answer, I would really appreciate if you please Mark it as Resolved, and give it a thumbs up, so it can help others
Cheers
Thank You
Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
https://gernaeysoftware.com
LinkedIn: https://www.linkedin.com/in/michaelgernaey
mmbr1606
22
Super User 2025 Season 1
stampcoin
17
ankit_singhal
11
Super User 2025 Season 1