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 / Patch multiple items i...
Power Apps
Unanswered

Patch multiple items in a gallery at one button click power apps

(0) ShareShare
ReportReport
Posted on by 433

Hello Power Users,

 

I have a gallery in a power app that displays the items with status in progress and would like to have a button outside the gallery. Button on click should approve all the items displayed in the gallery. Found lot of solutions in the community but for some reasons it still throws error. Here's my code

 

ForAll(Gallery.AllItems, Patch(TableName, {ReqStatus : "Approve"}))

 

When I hover on the table name it says "Invalid argument type (Guid). Expecting a Table value instead"

When I hover on the column name, reqStatus says "The specified column 'ReqStatus' does not exist"

 

ReqStatus column is single line of text on data verse table.

 

Can anyone please help me if anything wrong in my code.

 

Thank you for your help in advance!

Categories:
I have the same question (0)
  • EddieE Profile Picture
    4,641 Moderator on at

    @KrishR 

    You could try Patch( ForAll()) instead

    Patch(
     TableName,
     ForAll(
     Gallery.AllItems As _myPatch, 
     {
     ID: _myPatch.ID,
     ReqStatus : "Approve"
     // If ReqStatus column is a Choice type, try this
     // ReqStatus : {Value: "Approve"}
     }
     )
    )

     

    Change .ID to the relevant DataVerse record reference. The .ID is a SharePoint reference. I don't work with DV so you will likely need to adjust that part.

     

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @KrishR ,

    ForAll(Gallery.AllItems as G, Patch(TableName,LookUp(TableName,Name = G.Name),{ReqStatus : "Approve"}))


    Hope this will help you,

    Best Regards,
    Tina

  • KrishR Profile Picture
    433 on at

    Hi @EddieE ,

     

    Thanks for your time and help.

     

    Can you please help me with what should my code go in place or "_myPatch" from 

    ForAll(
     Gallery.AllItems As _myPatch, 
     {
     ID: _myPatch.ID,

    Can you please help me understand.

     

    Thanks again!

  • EddieE Profile Picture
    4,641 Moderator on at

    @KrishR 

    There's no need to change that - it's just a reference you use in your code, it doesn't reference any of your data sources.

     

    As usage

     

  • KrishR Profile Picture
    433 on at

    Hi @EddieE ,

     

    Thanks for the explanation. I tried the formulae and on click of the button it started creating new items instead of updating the items present in the gallery. Do we have to add a lookup or filter the gallery to choose the items to update.

     

    In my case I had the gallery to show the items whose status are empty or rejected. And update all of them with status value as Approved.

     

    Thank you so much again!

  • EddieE Profile Picture
    4,641 Moderator on at

    @KrishR 

    What is the Items property of the gallery? Does it contain the ID (or equivalent in DataVerse) ?

     

  • KrishR Profile Picture
    433 on at

    @EddieE 

    It doesn't have any id I'm referring to.

    Item property of the gallery :

     

    Filter(TableName, Status <>"Completed" && Status <> "Denied")

    Thank you

  • EddieE Profile Picture
    4,641 Moderator on at

    @KrishR 

    Ok, then what is the 'Primary Key' / record identifier for your records, ie what is that field called?

     

    You couldn't do a LookUp or Filter without some sort of record reference.

     

    The way the ID works in my formula above is that it resolves the ID for you. For example, if you are patching New records then there will be no ID present, so the formula will know to create a New record. However, if there is an ID present (ie an existing record) then the Patch knows to Update instead. It's quite clever.

  • KrishR Profile Picture
    433 on at

    @EddieE ,

     

    I have Name column as Primary name column. How do I filter on that column?

     

    Thank you!

  • EddieE Profile Picture
    4,641 Moderator on at

    @KrishR 

    Try replacing ID with Name, ie

    Patch(
     TableName,
     ForAll(
     Gallery.AllItems As _myPatch, 
     {
     Name: _myPatch.Name,
     ReqStatus : "Approve"
     // If ReqStatus column is a Choice type, try this
     // ReqStatus : {Value: "Approve"}
     }
     )
    )

     

     

     

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 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard