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 / Error Collect Function
Power Apps
Unanswered

Error Collect Function

(0) ShareShare
ReportReport
Posted on by 22

NotePad1234_0-1710156578312.png

Hello,

 

I have created a shopping cart, and at the checkout process i want when the user clicks the check out button.

It collects the items from the shopping card and adds to sharepoint list 'orders' but also creates an ID so when looking at sharepoint list so they can be matched up.

 

Appreciate some help please thank you

Capture.PNG
Categories:
I have the same question (0)
  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @NotePad1234 

     

    can u please copy/paste your code here so we do not have to retype.

     

    thanks

  • NotePad1234 Profile Picture
    22 on at

    Sorry

     

    Set(varRecordID,  Patch('FSE Uniform Orders', Defaults('FSE Uniform Orders'),{Title: TextInput2.Text,'Order Comments': TextInput1.Text, 'Engineer Number':TextInput7.Text}).ID);
    Collect('FSE Uniform Ordered Items', AddColumns ('FSE Uniform Orders', "OrderID", varRecordID))
  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    thank you

     

    can you try this:

    // Step 1: Patch the new order and capture the ID
    Set(varRecord, Patch('FSE Uniform Orders', Defaults('FSE Uniform Orders'), {
     Title: TextInput2.Text, 
     'Order Comments': TextInput1.Text, 
     'Engineer Number': TextInput7.Text
    }));
    Set(varRecordID, varRecord.ID);
    
    // Step 2: Iterate over the shopping cart items and add them to 'FSE Uniform Ordered Items'
    ForAll(colShoppingCart, 
     Collect('FSE Uniform Ordered Items', 
     {
     'Related Order': LookUp('FSE Uniform Orders', ID = varRecordID), // Assuming 'Related Order' is your SharePoint list column name that refers back to 'FSE Uniform Orders'
     'ItemName': ItemName, // Replace 'ItemName' with the actual field name in your collection that holds the item's name
     'Quantity': Quantity // Replace 'Quantity' with the actual field name in your collection that holds the item's quantity
     // Add other fields as necessary
     }
     )
    );
    

     

    put it in the onselect of your checkbox 

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • muzammilasif Profile Picture
    73 on at

    What I have understood is that you want to create a collection of newly generated ID's, in order to achieve this create a new collection with one column on screen onVisible property or in the app onStart property (as per your requirement) and after patch just add ID to that collection.

     

    Hope this helps!

  • NotePad1234 Profile Picture
    22 on at

    NotePad1234_0-1710158763656.png

    The first bit is great can see that it is assigning order ID,

     

    NotePad1234_1-1710158805791.png

    2nd bit im not so clear on, i would like it to assign the same order ID to the items the person has ordered.

     

  • NotePad1234 Profile Picture
    22 on at

    Hi Cna anyone help at all please?

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

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 294 Most Valuable Professional

#2
11manish Profile Picture

11manish 210

#3
Valantis Profile Picture

Valantis 169

Last 30 days Overall leaderboard