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 combobox to Shar...
Power Apps
Answered

Patch combobox to SharePoint list

(0) ShareShare
ReportReport
Posted on by 31

Hello,

 

I am trying to patch a Combobox to a SharePoint list.  The combo box has a list of values from a SharePoint list.  I got it so it does not throw errors in the compiler, but it just does not patch.  After I run the code, the Destination field is blank.

Patch(
 tblPass,
 {Destination: cboDestination})
Categories:
I have the same question (0)
  • wyotim Profile Picture
    2,545 on at

    Hey @aboucher, you are close! There is one property missing from your Patch statement: the Base Record. In between your data source and the record to be changed you need something to tell the Patch statement what to patch, either a new record or updating an existing one.

     

    Also, your reference to the combo box isn't fully qualified to reference the item you are trying to patch. It is instead referencing the control. To reference the selected value, you would have:

    cboDestination.Selected.*Value*

    where *Value* is the name of the field you are wanting to patch.

     

    To create a new record, you would use the Defaults function like so:

    // Patch a new record
    Patch(
     tblPass,
     Defaults(tblPass),
     {Destination: cboDestination.Selected.*Value*}
    )

     

    To update a record, you would need something that identifies the specific record you are trying to change. Using a LookUp is one nice way but you could also reference a selected item in a gallery or some similar technique. I'd be happy to help out with the specifics of that if you would like but here are some examples:

    // Patch an existing record with LookUp
    Patch(
     tblPass,
     LookUp(tblPass, ID = varItemID),
     {Destination: cboDestination.Selected.*Value*}
    )
    
    // Patch an existing record with a gallery item
    Patch(
     tblPass,
     Gallery.Selected,
     {Destination: cboDestination.Selected.*Value*}
    )

    The important aspect is that it needs to be a Record (i.e. row of the table) that is referenced.

     

    I hope that gets you going with your Patch statement! Please let me know if I can clarify or offer further assistance!

  • aboucher Profile Picture
    31 on at

    @wyotim wrote:

    Hey @aboucher, you are close! There is one property missing from your Patch statement: the Base Record. In between your data source and the record to be changed you need something to tell the Patch statement what to patch, either a new record or updating an existing one.

     

    Also, your reference to the combo box isn't fully qualified to reference the item you are trying to patch. It is instead referencing the control. To reference the selected value, you would have:

    cboDestination.Selected.*Value*

    where *Value* is the name of the field you are wanting to patch.

     

    To create a new record, you would use the Defaults function like so:

    // Patch a new record
    Patch(
     tblPass,
     Defaults(tblPass),
     {Destination: cboDestination.Selected.*Value*}
    )

     

    To update a record, you would need something that identifies the specific record you are trying to change. Using a LookUp is one nice way but you could also reference a selected item in a gallery or some similar technique. I'd be happy to help out with the specifics of that if you would like but here are some examples:

    // Patch an existing record with LookUp
    Patch(
     tblPass,
     LookUp(tblPass, ID = varItemID),
     {Destination: cboDestination.Selected.*Value*}
    )
    
    // Patch an existing record with a gallery item
    Patch(
     tblPass,
     Gallery.Selected,
     {Destination: cboDestination.Selected.*Value*}
    )

    The important aspect is that it needs to be a Record (i.e. row of the table) that is referenced.

     

    I hope that gets you going with your Patch statement! Please let me know if I can clarify or offer further assistance!


    Hello @wyotim, thanks for the replay.

     

    I am a little confused on the Selected.*Value*.  Isn't the name of the field "Destination"? Or am I way off base when you say "Field".  

    I am using the patch to create a new record.  

  • DMumbai Profile Picture
    12 on at

    For whatever reasons .. creating new records stops working for me. Does it give


    @aboucher wrote:

    @wyotim wrote:

    Hey @aboucher, you are close! There is one property missing from your Patch statement: the Base Record. In between your data source and the record to be changed you need something to tell the Patch statement what to patch, either a new record or updating an existing one.

     

    Also, your reference to the combo box isn't fully qualified to reference the item you are trying to patch. It is instead referencing the control. To reference the selected value, you would have:

    cboDestination.Selected.*Value*

    where *Value* is the name of the field you are wanting to patch.

     

    To create a new record, you would use the Defaults function like so:

    // Patch a new record
    Patch(
     tblPass,
     Defaults(tblPass),
     {Destination: cboDestination.Selected.*Value*}
    )

     

    To update a record, you would need something that identifies the specific record you are trying to change. Using a LookUp is one nice way but you could also reference a selected item in a gallery or some similar technique. I'd be happy to help out with the specifics of that if you would like but here are some examples:

    // Patch an existing record with LookUp
    Patch(
     tblPass,
     LookUp(tblPass, ID = varItemID),
     {Destination: cboDestination.Selected.*Value*}
    )
    
    // Patch an existing record with a gallery item
    Patch(
     tblPass,
     Gallery.Selected,
     {Destination: cboDestination.Selected.*Value*}
    )

    The important aspect is that it needs to be a Record (i.e. row of the table) that is referenced.

     

    I hope that gets you going with your Patch statement! Please let me know if I can clarify or offer further assistance!


    Hello @wyotim, thanks for the replay.

     

    I am a little confused on the Selected.*Value*.  Isn't the name of the field "Destination"? Or am I way off base when you say "Field".  

    I am using the patch to create a new record.  



    a random error about "field missing" Anyone having the same issue?

  • wyotim Profile Picture
    2,545 on at

    Hey @aboucher, apologies for the ambiguity!

     

    It very well could be Destination but it depends on how your combo box is set up. For instance, if your combo box is set up to show distinct values in a table it could be Result as that is what PowerApps names a column that results from a Distinct formula. It could be Value if you hard-coded some items into the combo box. If you connected a table to the combo box, you would use the name of the field you are after, such as Destination.

     

    I am guessing that the last one is the scenario you are using, so Destination would probably be the field you are after. Without knowing your particular situation I was trying to keep it open and avoid confusion but I didn't do too well I guess! Smiley Very Happy Let me know if that sorts things out or if I can try to help out further!

     

     

  • wyotim Profile Picture
    2,545 on at

    @DMumbai, I would check to see if there is a required field that you aren't patching as that is usually the case with that error, at least in my experience. It can be a bit tough to sort out because it doesn't tell what field is missing. I would go to the data source and see what fields are required, if any, and compare that to your Patch statement. Feel free to reply with more info if you would like; I'd be happy to try and help out!

  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at
    First question is, what is the data type of the column in SharePoint, that will determine how you patch it.
  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    I have a lookup column in this example, but I beleive the same would work for a Choice column. Anyway, I collect the changes in the combobox into a collection, then loop the collection to add the values. It's fairly Simple once you have this info :). 

     

    So on button click I have this at the top:

    ClearCollect(SelectedLocations,drp_AccountingLocation.SelectedItems);

    then the patch after. and for the "Location:" column, I use the ForAll to loop through that collection and add the values. 

    Location: ForAll(SelectedLocations,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id:ID,
    Value:Title})

     

    But I also use this method because I customize the display name used in the drop downs to a different value. If you don't do that, I think you can just use something like this in patch. 

     

    Location: combobox.SelectedItems 

     

    Should be all you need. 

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

    Hi @aboucher ,

    Could you tell me

    1)the setting of the combo box's Items?

    2)the data type of Destination field?

    Firstly, the right syntax of Patch a new record should be like this:

    Patch(
     tblPass,
    Defaults(tblPass), {Destination: ....})

    Secondly, how to patch Destination field is decided about the two questions that I asked.

    Thirdly, as @wyotim  said, do you have any required field?

    If you have, you should patch with this field's value, or else the patch function will not work.

     

     

    Best regards,

  • aboucher Profile Picture
    31 on at

    The choices in the list are coming from the choices setup in Sharepoint.  It also allows for fill-ins.  Below is the screenshot of the settings of this column of the Sharepoint list.  I ran into issues with required fields earlier on in the development of this, so now there are no required fields.

    Capture.PNG

  • Verified answer
    aboucher Profile Picture
    31 on at

    Well, I got it to work.  I ended up just using cboDestination.selected.

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 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard