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 / Difficulty patching Co...
Power Apps
Answered

Difficulty patching ComboBox into Lookup field in Sharepoint list

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I'm having some difficult patching a ComboBox selection into a new record in a SharePoint list. The SharePoint list I'm patching into is "People", and it has a lookup column "organization_id" which contains the ID of the organization that person belongs to. I have a separate Organization list.

 

Here is the Patch function I'm trying: 

Patch(
People,
Defaults(People),
{
person_ID: 9999,'
name_of_person: NameInput.Text,
position_title: TitleInput.Text,
phone: PhoneInput.Text,
email: EmailInput.Text,
bio_url: BioInput.Text,
organization_id: LookUp('Organizations', ID=OrgComboBox.Selected.ID)
}
); Notify("Your data has been entered.", NotificationType.Success, 5000)

The People list (not all fields are shown here):

People.png

 

The Organization list (again, not all fields are shown):

Organization list (not all fields are shown)Organization list (not all fields are shown)

 

I'm getting several errors with my Patch:

"Invalid argument type. Expecting a Record type, but of a different schema."

"Missing column. Your formula is missing a column "Id" with a type of "Number."

The function 'Patch' has some invalid arguments."

 

I don't understand what I'm doing wrong. If I'm patching a Lookup column, I should be giving a Record from Organizations right? Isn't that what LookUp('Organizations', ID=OrgComboBox.Selected.ID) does?

 

Categories:
  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    Hi @Anonymous ,

     

    Assuming it is just the SharePoint Lookup field you are having trouble patching, could you try:

     

    Patch(
     People,
     Defaults(People),
     { 
     person_ID: 9999,'
     name_of_person: NameInput.Text,
     position_title: TitleInput.Text,
     phone: PhoneInput.Text,
     email: EmailInput.Text,
     bio_url: BioInput.Text,
     organization_id: {
     Id: OrgComboBox.Selected.ID,//ID is the SharePoint ID. No need to change this
     Value: OrgComboBox.Selected.'Your ID field'
     }
     }
    ); Notify("Your data has been entered.", NotificationType.Success, 5000)

     

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello Imran-Ami Khan,

     

    Thank you, but this did not work. I tried submitting the form, and it sumbitted successfully but there's nothing in the organization_id column.

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

    @Anonymous please share your code

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Here is my code:

    Stephen572_0-1689628331653.png

     

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

    Thanks @Anonymous.

     

    There is nothing which looks obviously wrong to me (apart from adding a success notification after the patch, but that's a different conversation).

     

    Possibly one for @WarrenBelz / @LaurensM / @timl 

  • Verified answer
    WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Thanks for the tag @Amik ,

    @Anonymous ,

    Lookup columns are going to cause you unnecessary grief and are redundant generally unless you want to use Grid View in SharePoint (I never use them), but that is another discussion. When you change the Items of a Combo Box from the "standard" Choices(ListName.LookupFieldName), you lose the Id reference, which is actually the ID of the record in the other list you are looking up with the field. As a result, you need to "get it back" with something like this (I do not know the Field Name that the Combo Box is displaying)

    organization_id: 
    {
     Value: OrgComboBox.Selected.FieldName,
     Id:
     LookUp(
     YourOtherList,
     YourLookedUpFieldName = OrgComboBox.Selected.FieldName
     ).ID
    }

    The actual Items of the Combo Box would be useful here.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello WarrenBelz,

     

    This solved it, thank you!

     

    Stephen

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard