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 / ForAll & Patch not wor...
Power Apps
Answered

ForAll & Patch not working

(0) ShareShare
ReportReport
Posted on by 301

I have a Parent list A and Child B, they have One to many relationship.
I have form to create a parent item with couple of fields and just below it, grid type fields to create multiple child list item.
ListA.ID = ParentID(column in List B)
Now, If I open any existing record , List A details on the form comes and below list B relevant details are displayed .

 

ClearCollect(colChildList,Filter(ListB,ParentID = varRecord.ID))
I'm using a collection to add and update record in the ListB fom the grid (colchildlistgrid), everything is working fine.
Now, when i try to create a new ListA item and along with listB item, the parentID of ListB item remains blank, because my ListA item haven't being created yet.
So OnSuccess property of form for listA I used below formula,
Set(varParent,ManHourRebookingRequestForm.LastSubmit);
ForAll(
    Filter(
        colChildList,
        'Created By'.DisplayName = Office365Users.UserProfileV2(User().Email).displayName && Personnel_No = varParent.'Personnel No.' && ParentID = Blank()
    ),
Patch(
    ListB,ThisRecord
    ,
    {
        ParentID: varParent.ID
    }
));
ForAll is not working for me.
But instead, If I patch a single record of ListB by using 
Patch(
ListB,
LookUp(
ListB,
ParentID = Blank() && Personnel_No = ManHourRebookingRequestForm.LastSubmit.'Personnel No.'
),
{
ParentID: ManHourRebookingRequestForm.LastSubmit.ID
}
)
is working fine.
I dont get where its failling to update.
Any expert who can help me understand the error for me.
Onsuccess.png
Categories:
  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    A ForAll()/Patch() combination usually needs an As operator to keep the records straight. It will look like:

    ForAll(
     Filter() // put your filtering parameters in here
     As aItem, // the As operator
     Patch(ListB, aItem, {changeRecordItems} //put your change record in here
     )
    )

    Hope that helps,

    Bryan

  • Ape Awakening Profile Picture
    301 on at

    @BCLS776  , hey thank you so much , it worked perfectly. 

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard