web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Dataverse with C...
Power Apps
Unanswered

Patch Dataverse with Collection

(0) ShareShare
ReportReport
Posted on by 1,387 Moderator

I have an app that builds a collection. Now I want to Patch that collection into a Dataverse table.

 

What is the format my code should be? How do I marry the column in my Collection with that of the Table in Dataverse?

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @IPC_ahaas - it would save time if you confirmed what the Dataverse field types in your Collection (Text, Date, Choice (Local or Global) etc.

  • IPC_ahaas Profile Picture
    1,387 Moderator on at

    Hi @Amik , these are the columns I'm working with right now in Dataverse:

     

    IPC_ahaas_0-1708379409870.png

     

    This is the collection my PowerApp has currently:

    ID: CountRows(ColBundles)+1,
    Tag: InpManualTag.Text,
    Method: "Manual",
    Row: InpManualRow.Text,
    ScanDateTime: Text(Now(),DateTimeFormat.LongTime24),
    ScanBy: User().Email
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @IPC_ahaas please confirm which fields in your Collection should be saved to which fields in your Dataverse table.

  • IPC_ahaas Profile Picture
    1,387 Moderator on at
    Dataverse PowerApp
    ipc_InvDate
    ScanDateTime (date only)
    ipc_InvMethod
    Method
    ipc_InvRow
    Row
    ipc_InvSite
    VarSite
    ipc_InvTag
    Tag
    ipc_InvType Bundles
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @IPC_ahaas -

     

    1. I note you have not included an ID to uniquely identify the record. Do you understand that this will create new records and not update existing records?
    2. I assume VarSite is a Local or Global variable. Could you confirm how that variable is being generated.
  • IPC_ahaas Profile Picture
    1,387 Moderator on at

    1. Correct, I want new data not updating data.

    2. Var site is determined when they launch the app and click a button. It will have a text value (ex. "CH").

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @IPC_ahaas - I am not clear on how the fields you have presented in your Collection match with the fields in your Dataverse table, but see the example pattern below:

     

    ClearCollect(//generate our collection of updates and include the columns we want to update
     myCollection,
     (Table
     (
     {crb123_ipc_InvType: "Test 1", crb123_ipc_InvTag: "Test Tag 1", crb123_ipc_InvSite: VarSite, crb123_ipc_InvRow: 1, crb123_ipc_InvMethod: "Manual", crb123_ipc_InvDate: "Text Date 1"}
     )
    )
    );
    Patch(
     'Your Table',
     myCollection
    )
    

     

    Note above that the column names used in the Collection are the same Logical Names used for these columns in our data source.

  • IPC_ahaas Profile Picture
    1,387 Moderator on at

    I'm getting an error in the Patch area:

     

    IPC_ahaas_1-1708695844053.png

     

  • IPC_ahaas Profile Picture
    1,387 Moderator on at

    Also, this would just submit one set of dummy data from myCollection.

    I want to patch the collection ColBundles.

     

    Are you saying that my collection needs to have the same column names as my Dataverse table? There is no mapping function?

  • IPC_ahaas Profile Picture
    1,387 Moderator on at

    Changed things so my collection has the same column names as my Dataverse table, but I get this:

     

    IPC_ahaas_0-1708706012896.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard