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 / PowerApps Gallery dyna...
Power Apps
Unanswered

PowerApps Gallery dynamic rows not saved in correct order using ForAll(Patch())

(0) ShareShare
ReportReport
Posted on by 6

Hi Experts,

 

I am working on the App which contains Gallery with dynamic rows generated based on (Add Row) button click. I am facing issue on row ordering after save using 'Patch' function with 'ForAll'. ForAll with Patch function not saved the rows in correct order. Its worked fine till PowerApps release version (3.22034.17) and suddenly this issue happened on new release of PowerApps version.

 

I think this is Global Issue and many applications might affect due to this issue. can we get the fixes as soon as possible?

 

Example: I tried to save the records from 1 to 5 in order, but after save the order collapsed. see below screenshot for your reference.

Before save operation (correct Ordering)Before save operation (correct Ordering)

After save operation (ordering changed)After save operation (ordering changed)SharePoint List records saved in wrong orderingSharePoint List records saved in wrong ordering

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

    Hi @Udhayakumar,

    Currently, the easiest way is to revert your version back to 3.22034.17.

     

  • Udhayakumar Profile Picture
    6 on at

    Hi @v-qiaqi-msft ,

    Thanks for the suggestion, but I have already done lots of changes in last week and then realized the issue reported. It's not feasible to revert back to old version at this point. 

  • Udhayakumar Profile Picture
    6 on at

    Any updates on the reported issue? I have tested the latest version (3.22044.29), still this issue continues.

  • PaulD1 Profile Picture
    2,914 on at

    You can revert the version of studio without having to revert to an earlier version of your App. Go to File, Settings, Support and click Edit under Authoring version. Note that this does not let you revert the studio version very far so is only a short term solution 😞 

     

    I believe that it is intentional that ForAll does not necessarily process elements in order, I believe this is to try to improve performance (which needs all the help it can get!) by processing 'multiple threads' simultaneously and so there is no guarantee which will finish (in this case, Patch) first.  I think this is why it is termed ForAll rather than ForEach and also why it forbids the setting of any variables within the 'loop'.

     

    While my previous experience has also been that ForAll processes things in order, I would guess that this 'multi-threading' has finally been implemented or made more 'aggressive' hence you are now seeing a change in behaviour with things being processed 'out of order', so I doubt this will be treated as a bug and 'fixed'.

     

    In relational theory the order in which relations (records) are stored or output is not relevant, so I would have some sympathy with the product team here were it not for the fact that they have thrown out so much good relational practice with the (imo) abomination that is Dataverse.

     

    If the ordering of the records is important you will likely need to add an additional 'sortorder' field which you can later use to sort the records into the order of your choosing.

  • Udhayakumar Profile Picture
    6 on at

    Hi @PaulD1 ,

    Thanks for the suggestion, using 'Authoring Version' option we can only revert to previous version. But i have already made more no. of publishing, so this option not helping me at this point.

     

    Also i understand ForAll behavior worked in sequential order before i raised this issue, i really appreciate product team for making the ForAll behavior [parallel/multi threading] to improve performance. But they should provide the settings option for the users to choose (sequence order/parallel order) to eliminate this kind of issues. For my case i have dependencies logic with other galleries based on ordering and its really very difficult to add 'sortOrder' column for around 50+ galleries in multiple Apps.

     

    Really expecting 'fixes' from product team!

  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    Hi @Udhayakumar ,

    You did not post your Patch code, but have you considered putting a Sort into the items before the Patch.

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 224 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard