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 / Bug report: Patch func...
Power Apps
Unanswered

Bug report: Patch function not working as expected when merging records

(0) ShareShare
ReportReport
Posted on by 6,949

In the following expression, the first Patch function works, but the other two do not.

Clearly this is a bug, since the first argument of Patch can be a record or a table/collection.  Please see highlighted error.

 

__.JPG

 

Any ideas welcome.

Categories:
I have the same question (0)
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Meneghino,

     

    Patch( DataSource, BaseRecord, ChangeRecord1 [, ChangeRecord2, … ])

    DataSource – Required. The data source that contains the record that you want to modify or will contain the record that you want to create.

    I think you might missed some points, the first argument could be a datasource, or a collection.

    Some more information:

    "

    In your app, you'll use formulas to create, update, and manipulate records and tables. You'll probably read and write data to an external data source, which is an extended table. In addition, you might create one or more internal tables, which are called collections.

    "

    See: Understand tables and records in PowerApps

    Please try to add table function with the Current_A (and current_B), see if that would help.

    Regards,

    Michael

     

  • Meneghino Profile Picture
    6,949 on at

    Hi @v-micsh-msft, thanks for getting back to me.

    Please see documentation here.

    It clearly states: "Even if you're not working with a data source, you can use Patch to merge two or more records"

    The syntax is explained in the page and states: Patch( Record1, Record2 [, …] )

    It works in the first instance but not in the other instances of my example.

     

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

    Thanks for the remindings.

    My bad.

    I will take some tests from my side and update later.

    Regards,

    Michael

     

     

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

    Hi @Meneghino,

     

    See the test results:

    18.PNG

     

    No corresponding errors popped out from my side.

    Would it be related to the collection name?

    May you take a try to change the two collection names without the "_"?

    Regards,

    Michael

  • Daryl LaBar Profile Picture
    156 Most Valuable Professional on at

    I'm experiencing something very similar, where a patch call is changing the type of the context variable to be a datasource/collection, which conflicts with all uses of the variable, since it is indeed just a record.  If I remove the call, it will re-evaluate and treat the variable as a record, and then paste back in, it will again, treat it as a record and the app will work.  Saving the app will not fix the issue going forward.

    Did you get your issue resolved?

     

    Did you find a work around?

  • PaulD1 Profile Picture
    2,914 on at

    As a work-around, have you tried creating a collection, populating it with your context variable, performing the patch on the collection and then assigning the one row of the collection back to the context variable (using First or LookUp to return a record datatype)?

  • Daryl LaBar Profile Picture
    156 Most Valuable Professional on at

    @PaulD1 I saw that in another location in the app, I bet that is why and I bet it would work.  My current work around is to do another lookup for the object out of the gallery.

     

    I'm currently fighting for this to be considered a bug, and for it to get prioritized.  

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 366 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 99 Super User 2026 Season 1

Last 30 days Overall leaderboard