Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

For All and Patch Function, need help.

Posted on by 3,962

Hi Experts,

 

I have a form called Sales order form that is connected to the share point list Sales Order.  My goal is to document orders sent by a team member from the Sales order form with the functionality of having multiple rows for Product, Quantity, Product Colour and Supplier.  Using Shane's powerapps911 on you tube (part 1 to 3 to build infopath like app), I have designed the app similar to the usages but I'm stuck in the logic.

 

I have used a collection to collect the multiple rows.  I can see these collections in the app.  If i just use the edit form, I can see that the data is found and collected.  I am having issues with this formula and i'm not sure where the problem is, as when its submitted, the collection isn't added into the list.

 

ForAll(
ProductOrderCollection,
Patch(
'Sales Order',
Defaults('Sales Order'),
{
ProductOrdered: Product_Order,
ProductColour: Product_Colour,
Supplier: Product_Supplier,
Quantity: Product_Qty,

}

)

)

 

VarunNayak_2-1627398657157.png

 

I am using the Edit form for the left hand side and a gallery for the right hand.

 

VarunNayak_1-1627398590750.png

Can anyone help ?

  • RE: For All and Patch Function, need help.

    I've been following the tutorials from Shane powerapps911:

     

    https://www.youtube.com/watch?v=xgznk4XlPCo&t=787s

     

    So i've added the blank logic so i don't get a blank line in sharepoint.

     

    New formula:

    ForAll(ProductMultiOrder,If(!IsBlank(Customer_Product) ,Patch('Sales Order',Defaults('Sales Order'), {ProductOrdered:Customer_Product, Quantity:Value(Customer_Qty), ProductColour:Customer_Colour, Supplier:Customer_Supplier})))

  • RE: For All and Patch Function, need help.

    OK, So my app was somehow deleted.  Not sure why.  But I've re-created the setup but only to this issue previously.  It is working to an extent. 

     

    This is my current formula:

     

    ForAll(ProductMultiOrder,Patch('Sales Order',Defaults('Sales Order'), {ProductOrdered:Customer_Product, Quantity:Value(Customer_Qty), ProductColour:Customer_Colour, Supplier:Customer_Supplier, ID:New_Form.LastSubmit.'Master ID'}))

     

    I've found that it works if i remove the ID element of the file but i get 2 rows minimum when i want one.  I put in the Master ID because i wanted the same Customer to be filled in if there is multiple orders.  Below is a picture of how its submitting in the share point list.

     

    VarunNayak_0-1627706522651.png

    I need the customer details (Product, product colour, product qty, product supplier) to be multiplied while the customer master info (name, email etc) is the same.  What its doing now is 3 rows where i would need 2 and i need the customer fields populated.

     

    Can anyone help me ?

  • RE: For All and Patch Function, need help.

    No, I haven't considered using a model driven app.

  • RE: For All and Patch Function, need help.

    I can”t help you directly cause I’m not to much in power apps. But did you consider using a model driven app? It would be super simple to do header/line structured data

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans