web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Validating a ForAll Pa...
Power Apps
Unanswered

Validating a ForAll Patch Function

(0) ShareShare
ReportReport
Posted on by 9

I have a gallery of with input fields that I patch into the database. Is there a way to validate the patch has been successful or not?

 

ForAll('Gallery1'.AllItems,
Patch('Sharepoint List', {
Title : 'Combobox_1'.Selected.Code,
'Delivery Note' : 'TextInput_1'.Text,
}
);
);

 I have tried to make use of Errors function, made a field required in the list, and tried patching an empty data into it, but it returned Patch successful.

ForAll('Gallery1'.AllItems,
Patch('Sharepoint List', {
Title : 'Combobox_1'.Selected.Code,
'Delivery Note' : 'TextInput_1'.Text,
}
);
);
If(
IsEmpty(
Errors('Sharepoint List')
),
Notify("Patch Successful",NotificationType.Success),
Notify("There is an error with your Patch function",NotificationType.Error)
);

 

Categories:
I have the same question (0)
  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @alJohSe ,

     

    Can you try the following code?

    Clear(colErrors);
    
    ForAll(
     'Gallery1'.AllItems,
     IfError(
     Patch(
     'Sharepoint List',
     ThisRecord,
     {
     Title : 'Combobox_1'.Selected.Code,
     'Delivery Note' : 'TextInput_1'.Text
     }
     ),
     Collect(colErrors, {Title: 'Combobox_1'.Selected.Code, Message: FirstError.Message});
     )
    );
    
    If(
     CountRows(colErrors) > 0,
     Notify("There is an error with your Patch function",NotificationType.Error, 2000),
     Notify("Patch Successful",NotificationType.Success, 1000)
    )

     

    Hope this helps

  • alJohSe Profile Picture
    9 on at

    Hey @Ethan_R , thank you for the reply.

     

    I tried implementing the code you shared, but it runs into an error (invalid argument type table expecting a record value instead)

    ForAll(Gallery2.AllItems,
     IfError( 
     Patch(
     'Testing Test',
     LookUp('Testing Test',id0 = TextInput2.Text),
     {
     Title: TextInput1.Text}),
     Collect(colErrors,
     {
     Title:TextInput1.Text,
     Message:FirstError.Message
     }
     )
     );
    );

    However, the code runs fine if I remove the ForAll function.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard