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 / Adding succes and erro...
Power Apps
Answered

Adding succes and error notifications to a ForAll Gallery patch

(0) ShareShare
ReportReport
Posted on by 97

Hello,

I have a multiscan barcode reader app that patches to a SQL DB. I am trying to add the success and error notifications that are working on the single scan version of the app.

I receive an 'Error. Cannot update' notification in the app but in the app Monitor (as well as on the SQL DB) I have all successes.

 

 If(
 IsEmpty(
 Errors(
ForAll(
 Gallery1.AllItems,
 Patch(SQLDB, Defaults(SQLDB), 
{SerialNumber: lbl_Scans.Text, 
Status: lbl_default_Status_1.Text, 
Location: dd_Location_2.Selected.Value, 
Model: dd_SelectItem_3.Selected.Value, 
Manufacturer: dd_SelectItem_3.Selected.Manufacturer, 
ScanDate: Now(), 
ScannedBy: User().FullName,
AssignedTo:lbl_IT_Storage_1.Text,
OSName: dd_SelectItem_3.Selected.OSName,
Type: dd_SelectItem_3.Selected.Type})
 )
 )
 ),
 Notify("Update Successful",NotificationType.Success; 1);Set(SuccessNotify,true),
 Notify("Error. Cannot update.",NotificationType.Error);Set(ErrorNotify, true)
)

 

Categories:
  • Verified answer
    Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @CPGDallas ,

     

    Is this what you are trying to do?

     

    ForAll(
     Gallery1.AllItems,
     With(
     {
     CurrentRecord: ThisRecord
     },
     IfError(
     Patch(SQLDB, Defaults(SQLDB), 
     {SerialNumber: lbl_Scans.Text, 
     Status: lbl_default_Status_1.Text, 
     Location: dd_Location_2.Selected.Value, 
     Model: dd_SelectItem_3.Selected.Value, 
     Manufacturer: dd_SelectItem_3.Selected.Manufacturer, 
     ScanDate: Now(), 
     ScannedBy: User().FullName,
     AssignedTo:lbl_IT_Storage_1.Text,
     OSName: dd_SelectItem_3.Selected.OSName,
     Type: dd_SelectItem_3.Selected.Type}
     ),
     Notify("Error. Cannot update Record - "&CurrentRecord.Name, NotificationType.Error, 1000);
     false;
     ,
     Notify("Update Successful",NotificationType.Success, 500);
     true;
     )
     )
    )

     

     

    Just make sure, you use CurrentRecord like CurrentRecord[@ColumnName] is you have fields in them. else its fine

    Hope this helps

  • CPGDallas Profile Picture
    97 on at

    That did it.  Here's my final code:

    ForAll(
     Gallery1.AllItems,
     With(
     {
     SerialNumber: ThisRecord
     },
     IfError(
     
     Patch(SQLDB, Defaults(SQLDB), 
    {SerialNumber: lbl_Scans.Text, 
    Status: lbl_default_Status_1.Text, 
    Location: dd_Location_2.Selected.Value, 
    Model: dd_SelectItem_3.Selected.Value, 
    Manufacturer: dd_SelectItem_3.Selected.Manufacturer, 
    ScanDate: Now(), 
    ScannedBy: User().FullName,
    AssignedTo:lbl_IT_Storage_1.Text,
    OSName: dd_SelectItem_3.Selected.OSName,
    Type: dd_SelectItem_3.Selected.Type}
     ),
     Notify("Error. Cannot update Record - ", NotificationType.Error, 1000);
     false;
     ,
     Notify("Update Successful",NotificationType.Success, 500);
     true;
     )
     )
    )

    My single scan submit played a sound upon success and another sound on error.  I tried bringing that over but the error message was that it couldn't be done on a 'ForAll'.  Which makes sense.  Twenty scans playing the sound fx twenty times.  I'll take this!

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard