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 / Saving Collection to List
Power Apps
Answered

Saving Collection to List

(0) ShareShare
ReportReport
Posted on by 204

HI,

 

I'm having a product list which will display available products and user selects required products and add it cart. for that I'm using a collection for the selected products.

 CartCart

 

Now, how can i save these collections items back to the orders list. since it will be different for different users i.e. one user will select 2 products where some will select 3 products. so how can i save it back to order list accordingly. 

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Krishna98 :

    Could you describe your requirements in detail?

    • What is the data structure of your SharePoint list?
    • What is the data structure of your Collection?
    • Which fields in the Collection do you want to update to which fields in the ShatePoint List?
    • Is the update method to directly add records (or modify records) or do some calculations need to be performed?

    Best Regards,

    Bof

  • Krishna98 Profile Picture
    204 on at

    Hi @v-bofeng-msft 

     

    This is my collection structure,1.PNG

     

    and i haven't created my list yet. 

     

    my requirement is that, user named xyz comes and places orders for 3 mobiles(i.e. above collection details) so in the backend  list i have to save that user xyz has ordered for these 3 products and these are the details ( Mapping kind of thing )

     

    and another user abc comes and places orders for 2 mobiles and after clicking place order button i need to save the data something like. the user abc has ordered for these 2 products and these are the details

     

    so how can i map/save the order details of the mobiles to the particular user. 

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Krishna98 :

    Do you mean:

    • There are two lists, one list saves users and user orders, and one list saves order details.
    • You want to link these two orders in some way.

    If my understanding is correct, just create a unique identifier "order number" field.

    List1:

    UserName(Text) OrderNumber(Text)
       
       

    List2:

    OrderNumber(Text) Image Manfact Modified Price Title
               

    When you save the record, you can first generate a random and unique order number.For example:

    Set(TheVar,Text(Now(),"[$-en]yyyymmddhhmmss")& Text(RoundUp(Rand()*10000,4),"[$-en]0000"));/*Randomly create an order number*//*TheVar is my custom variable*/
    Patch(List1,Defaults(List1),{UserName:User().FullName,OrderNumber:TheVar});
    Patch(List2,{OrderNumber:TheVar,Imate:xxx,Man……})

    So you can find the corresponding records in list2 by order number.

    Best Regards,

    Bof

  • Krishna98 Profile Picture
    204 on at

    Hi @v-bofeng-msft 

     

    Thanks i think it can solve my problem. but how can i patch all the items into list2. for loop kind of thing like

    for(all the items in the collection) => patch(item to the list2 with the same ordernumber)

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Krishna98 :

    Please try this code:

    ForAll(
     TheColelction,
     Patch(List2,{OrderNumber:TheVar,column1:TheColectionColumn1,column2:heColectionColumn2})
    )

    In addition,If you want to save the picture to the SharePointlist, it will be more difficult, I suggest you convert the picture into binary text and save it in the "mutiple line of text" column.I think this link will help you a lot:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Save-image-in-SharePoint-List/m-p/590489#M185192

    Best Regards,

    Bof

  • Krishna98 Profile Picture
    204 on at

    Hi @v-bofeng-msft 

    Thanks, i got it 🙂

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

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard