Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

ForAll - ThisRecord broken?

(1) ShareShare
ReportReport
Posted on by 36

I have a piece of code which was definitly working fine 2 days ago, now is completely broken. I have tackled it down to be a broken funcktionallity in Combination of "ForAll" and "ThisRecord". I have prepared a simplified code snippet to show the issue:

 

 

 

ClearCollect(Collection1;Table({ID:1};{ID:2};{ID:3}));;
ClearCollect(ItemsToRemove;Table({ID:2}));;


ForAll(ItemsToRemove;
 Notify("ID of Record of ItemsToRemove-Collection:" & ThisRecord.ID & " - this is correct." & Char(13)&
 "ID of Looked up Value in Collection: " & First(Filter(Collection1;ID=ThisRecord.ID)).ID &". This is incorrect. Should be 2, not 1" 
));;

 

Put this snippet on a button and you will be able to reproduce the issue.

 

I am pretty sure this is a major bug which was introduced within the last 48 hours.

This has enourmos impacts. LookUps / Filters / RemoveIf to a SQL Server Database will have the exact same issue and affect random records. Due to this, our Canvas App is currently deleting random records from a SQL Server Database instead of selected ones.

 

 

  • CU30070528-1 Profile Picture
    on at
    ForAll - ThisRecord broken?
    Facing same issue and Alias not working as expected
  • Sascha2 Profile Picture
    36 on at
    Re: ForAll - ThisRecord broken?

    Thanks, indeed using the Alias here seems to solve the issue. I'll implement that. Thanks so far.

  • Verified answer
    Gerard Simpson Profile Picture
    2,987 Super User 2025 Season 1 on at
    Re: ForAll - ThisRecord broken?

    Hi @Sascha2 

     

    It might be something to do with the nested 'ThisRecord' which is causing conflicts.

     

    Can you try redefining your source using the 'As' function, so you can use something other than ThisRecord and potentially avoid conflicts - in this example I have just called it 'ITR'

     

    ClearCollect(Collection1;Table({ID:1};{ID:2};{ID:3}));;
    ClearCollect(ItemsToRemove;Table({ID:2}));;
    
    
    ForAll(ItemsToRemove As ITR;
     Notify("ID of Record of ItemsToRemove-Collection:" & ITR.ID & " - this is correct." & Char(13)&
     "ID of Looked up Value in Collection: " & First(Filter(Collection1;ID=ITR.ID)).ID &". This is incorrect. Should be 2, not 1" 
    ));;

     

     Hope this Helps

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard