Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Patch + ForAll adding duplicates in DB

Hello, I'm coming across a very strange error I was hoping I could get a hand with.


I have a list of items in which I make sure I only have unique occurrences, and I need to insert these in the Database as completely new rows. 


    Distinct(col_selectedItemsApproval, ThisRecord.ID),
    LookUp(col_selectedItemsApproval, Result = ThisRecord.ID)

Patch(FCT_TimesheetApprovalStatus, ForAll(col_selectedItemsApproval_Unique, {
    SubmitterID: ThisRecord.SubmitterID,
    ProjectID: ThisRecord.ProjectID,
    Hours: ThisRecord.Hours,
    WeekDateStart: varWeekDayStart,
    Status: varApproveStatus,
    StatusUpdatedOn: Now(), 
    StatusUpdatedBy: User().Email,
    Active: true,
    CreatedBy: User().Email,
    CreatedOn: Now(),
    ModifiedBy: User().Email,
    ModifiedOn: Now()






 As you can see below, the col_selectedItemsApproval_Unique has a single record in it.



Problem is, when the patch is executed, that single record becomes 2 in the SQL Database:


* You can notice createdBy field is the same with just miliseconds difference. 


Bigger problem is:  This anomaly only happens sometimes, often it works well and only one record is added.


Hope someone already came across this error and can provide a solution,

Thank you!

Regular Visitor

Hi @_Corey_, would you know if this is a known issue that's been looked at?

I'm having a lot of problems with it on my current app, besides the one this one I've shared.


Appreciate any help on this!

Power Apps
Power Apps

@rpamaral Can you provide an example of a recent formula that is behaving incorrectly?

Power Apps
Power Apps

Hi all,


We're looking into this issue as we speak. Although the documentation of ForAll calls out the indeterminate order and potentially parallel processing, it was not enabled until recently. We realize that regardless of documentation this may be an unexpected change, so we've decided to roll this back. You can expect some future communication and a plan to handle enabling parallelization and any potential new functions that we guarantee to be executed serially.

Helpful resources

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,506)