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 / Patching Multiple rows...
Power Apps
Answered

Patching Multiple rows in Dataverse from a Gallery

(0) ShareShare
ReportReport
Posted on by 21

I ran into another issue, I was able to fix the previous one and your solution seemed to be working. thanks for that.

 

However, I have ran into another issue:

 

I am trying to patch multiple rows when hit submit. For some reason, it is not adding all the rows but the first one for three times.

 

ForAll(
GalCart_1.AllItems,
Patch(
'Employee Approval Requests',
Defaults('Employee Approval Requests'),
{
'Product Name': GalCart_1.Selected.Title1_1,
'Product Number': GalCart_1.Selected.ProductNumber,
'List Price': GalCart_1.Selected.Subtitle1_1,
Quantity: GalCart_1.Selected.Qty_1,
Total: GalCart_1.Selected.Total_1,
Color: GalCart_1.Selected.Color,
Comments: DataCardValue10_1.Text,
Approver: DataCardValue3_1.Text,
'Request Date': Today(),
'Requested By': DataCardValue5.Text
}
)
);
//SubmitForm('Approval Submission');
Notify(" Your request for approval has been submitted");
//Clear(CompareList);

 

Can you please suggest what is wrong. Cartlist is the gallery name and CompareList is the collection name.

 

MaryJam_0-1682288570855.png

 

 

 

I am also not able to see the edit form in preview mode, it may be because my patch function is not working as expected.

 

Can you please help! thanks!

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    Hi @MaryJam ,

    That is because you are referring to the record currently selected in the Gallery for all items - try this

    Patch(
     'Employee Approval Requests',
     ForAll(
     GalCart_1.AllItems As aGal,
     {
     'Product Name': aGal.Title1_1,
     'Product Number': aGal.ProductNumber,
     'List Price': aGal.Subtitle1_1,
     Quantity: aGal.Qty_1,
     Total: aGal.Total_1,
     Color: aGal.Color,
     Comments: DataCardValue10_1.Text,
     Approver: DataCardValue3_1.Text,
     'Request Date': Today(),
     'Requested By': DataCardValue5.Text
     }
     )
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • MaryJam Profile Picture
    21 on at

    Thanks so much! I replaced with the suggested one but I am getting a network error:

     

    MaryJam_0-1682289502380.png

     

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

    @MaryJam ,

    You can try the "long" way (less efficient) - but both structures are valid providing your control output references are valid

    ForAll(
     GalCart_1.AllItems As aGal,
     Patch(
     'Employee Approval Requests',
     Defaults('Employee Approval Requests'),
     {
     'Product Name': aGal.Title1_1,
     'Product Number': aGal.ProductNumber,
     'List Price': aGal.Subtitle1_1,
     Quantity: aGal.Qty_1,
     Total: aGal.Total_1,
     Color: aGal.Color,
     Comments: DataCardValue10_1.Text,
     Approver: DataCardValue3_1.Text,
     'Request Date': Today(),
     'Requested By': DataCardValue5.Text
     }
     )
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • MaryJam Profile Picture
    21 on at

     

    Thanks so much for the solution, I have managed to use the following patch code but having three fields that are not posting a value in dataverse. One of them is Total Amount. Comments and Approver.

     

    Patch(
    'Employee Approval Requests',
    ForAll(
    GalCart_1.AllItems As aGal,
    {
    'Product Name': aGal.ProductName,
    'Product Number': aGal.ProductNumber,
    'List Price': aGal.ListPrice,
    Quantity: aGal.Qty_1.Text,
    'Total Amount': aGal.Total_1,
    Color: aGal.Color,
    Comments: DataCardValue10_1.Text,
    Approver: DataCardValue3_1.Text,
    'Request Date': Today(),
    'Requested By': DataCardValue5.Text

    }
    )
    );

    //SubmitForm('Approval Submission_1');
    Notify(" Your request for approval has been submitted");
    //Clear(CompareList);

     

     

    MaryJam_0-1682311088715.png

     

    I have also noticed that the form doesnt not show in preview so I am unable to add comments.

     

    MaryJam_1-1682311180035.png

     

     

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

    Hi @MaryJam ,

    Are those textboxes Comments and Approver) inside or outside the gallery ? Also what is Total_1 in the gallery ?

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard