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 / Patch insert new multi...
Power Apps
Answered

Patch insert new multiple selected records into dataverse table

(0) ShareShare
ReportReport
Posted on by 820

Hi

I have a galery with checkboxes. I want to select multiple items and patch create records based on galery values and on additional textbox values into  specific dataverse table(not the table from where i get some info in galery)

these also include some lookup fields

What is the best approach of doing it?

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jja 

    Your formula would be similar to the following:

    Patch(yourDataSource,
     ForAll(Filter(yourGallery.AllItems, yourCheckbox.Value),
     {ID: ID,
     column1: column1Value,
     etc
     }
     )
    )
     

     

    You need to provide the primary key!  In the above ID is used as the primary key (i.e. SharePoint), so for Dataverse, determine what your primary key is and replace the two ID's in the above.

     

    I hope this is helpful for you.

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    I would recommend using a ForAll function...

     

    Maybe, first create a collection for the itens for each table and after that do the patch

    You check if the collection has data. If yes, ForAll() and Patch

    If not, nothing.

     

    ForAll - 
    https://docs.microsoft.com/en-US/powerapps/maker/canvas-apps/functions/function-forall

     

    Patch-

     

    https://docs.microsoft.com/en-US/powerapps/maker/canvas-apps/functions/function-patch

     

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Nogueira1306 

    No need to duplicate the data yet again in the app into a collection - the Gallery already contains all of the data needed.  Utilize the formula I provided to achieve the desired results.

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    You are correct @RandyHayes . I thought that he wanted to create multiple data in defferent tables. 

    Sorry @jja , just use ForAll() and Patch

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Nogueira1306 

    No worries - but even so, a collection is only needed when you need the ability to have an in-memory database with add/remove/edit capabilities.  For a Patch or ForAll or anything else that needs a table...well, all you need is a table!  AllItems is a Table 😁

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    @RandyHayes  my only idea on the collections was for separate the tables, it would be easier (in my opinion), after that they would be deleted. Since it only needs 1 table, you are completily right, a collection would only complicate and maybr put the app slower

  • julijazas Profile Picture
    820 on at

    Hi @RandyHayes in this table my primary name columns is Autonumber

    How do i handle it in patch?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jja 

    The Name of your column is Autonumber??  Or that is the type?

     

    What you need to do is to look at your table definition in dataverse and verify what the primary key is - it will be annotated as the primary key.  THEN you need to replace the ID (both of them) in the formula with the actual name of the column.  And to be clear - it is the Column Name that you want to put int, NOT the Display name.

  • julijazas Profile Picture
    820 on at

    Hi @RandyHayes Automumber is a type

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jja 

    Right...so as mentioned, you need to find your primary key and put the name of that into the formula.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard