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 Apps
Unanswered

Patch or Collect?

(0) ShareShare
ReportReport
Posted on by

Could someone please explain why I have just been unable to patch items from a Gallery back to a Dataverse table with the PATCH function, but with COLLECT it works?

 

Many thanks!

Categories:
  • WiZey Profile Picture
    3,023 Moderator on at

    Hello @jed76 ,

     

    Depends, how are you using "Patch()"?

     

    To create a record with "Patch()", use:

     

    Patch(
     source,
     Defaults(source),
     record
    )
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @jed76,

    Patch() and Collect() can both be used to add a record to a data source.

    Typically Patch() is used to modify entire records or the values of specific fields in a record, however when used with the defaults function it behaves in a similar way to Collect().

     

    An important difference is Patch() can only add to an existing collection whereas Collect will create the collection if it doesn’t already exist.

    So use Patch to amend records in existing collections and Collect to define a new collection. Patch is also more suitable for amending a subset of fields in a collection.

  • jed76 Profile Picture
    on at

    Many thanks. I couldn't understand why Collect would work, but Patch wouldn't. This was for patching/collecting BACK to a data source, not TO a collection. 

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @jed76,

    Too few details to figure it out.

    You don't tell the detailed scenario, I just give a example for reference.

  • jed76 Profile Picture
    on at

    Thanks. I'm beginning to think that not using collections is a better way to go if they can be avoided. I've just changed my app to work on the live data instead and it seems so much simpler. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard