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 / Trouble Patching Share...
Power Apps
Answered

Trouble Patching SharePoint Lookup Fields in PowerApps Using ComboBox Selections

(0) ShareShare
ReportReport
Posted on by 29

Hi everyone,

I'm working on a PowerApps canvas app where I need to create entries in a SharePoint list ('Conjunctions') based on selections from a ComboBox ('ComboBox3'). The 'Conjunctions' list includes Lookup fields that reference other SharePoint lists ('Participant Database' for participants and 'Community Activities' for activities).

The list's purpose is to create relationships between events and people (who is enrolled, who attended, etc)

I'm facing challenges when trying to patch selected participants from 'ComboBox3' into the 'Conjunctions' list, specifically with the Lookup fields 'Participant' (from 'Participant Database' SP list) and 'Activity' (from Community Activities SP list).

Here's the scenario:

  1. 'ComboBox3' Selection: Users select one or multiple participants from 'ComboBox3', which is populated from the 'Participant Database' list. This combobox actually draws from a powerapps collection created 'onvisible' of this page- works fine.


  2. Event Selection: The event with which these participants should be associated is selected from a gallery ('Gallery1'). This event information comes from the 'Community Activities' list, and I need to associate selected participants with this event in the 'Conjunctions' list.

  3. Patch Operation: I attempt to create new entries in 'Conjunctions' for each selected participant, linking them to the selected event using the Lookup fields.

    Problematic Code:

    ForAll(

        ComboBox3.SelectedItems,

        Patch(

            'Conjunctions',

            Defaults('Conjunctions'),

            {

                Participant: LookUp('Participant Database', ID = ComboBox3.Selected.ID),

                Activity: LookUp('Community Activities', ID = Gallery1.Selected.ID)

            }

        )

    )

    Errors Encountered:

    • Invalid argument type.

    • Expecting a Record value, but of a different schema.

Missing column 'Id' with a type of 'Number'.
I understand that Lookup fields require handling the ID of the item from the referenced list, but I'm not sure how to structure this correctly in PowerApps, especially when dealing with multiple selections from a ComboBox.

I'm entirely self taught with SP lists, Powerapps and Powerautomate, and doing ok, but have no prior experience in anything similar so in this case pretty much entirely in the dark on how to make this work...

Any support to get this working I would be very, very grateful 🙂

Thnx

Categories:
  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @zizzer 

     

    can you try this:

    ForAll(
     ComboBox3.SelectedItems,
     Patch(
     'Conjunctions',
     Defaults('Conjunctions'),
     {
     Participant: {Id: ComboBox3.Selected.ID},
     Activity: {Id: Gallery1.Selected.ID}
     }
     )
    )
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • zizzer Profile Picture
    29 on at

    Hi,

    thanks for your help, unfortunately doesnt seem to work:

    The function 'Patch' has some invalid arguments.

    Invalid argument'type. Expecting'a Record value, but of a different schema
    Incompatible type. The 'Id' column in the data source you're updating expects a 'Number' type
    and you're using a 'Error' type.
    ernal Partner_l Missing column. Your formula is missing a column 'Value' with a type of 'Text
  • Verified answer
    mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    can u try this instead:

    ForAll(
     ComboBox3.SelectedItems,
     Patch(
     'Conjunctions',
     Defaults('Conjunctions'),
     {
     Participant: {Id: Value(ThisItem.ID), Value: ThisItem.'YourParticipantFieldName'},
     Activity: {Id: Gallery1.Selected.ID, Value: Gallery1.Selected.'YourActivityFieldName'}
     }
     )
    )
    

     

    You should replace 'YourParticipantFieldName' and 'YourActivityFieldName' with the actual fields from your lists that store the names or primary values you're looking to reference. If your list configuration does not actually require this 'Value' part for the lookup to work, you may omit these and focus solely on ensuring the Id is correctly provided.

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • zizzer Profile Picture
    29 on at

    Hi again,

    Thanks for replying again.

    Still not working...

    -I used a text box to check the ID of both the Gallery and the combobox and the ID's of each do reflect the ID's in their respect origin SP lists.

    with this part:

    'YourActivityFieldName'}

    I wasn't sure if you meant the name in the 'conjunctions' lookup list we want to patch into, the origin lists- i tried both didn't seem to work either way.

    Same errors:

    The function 'Patch' has some invalid arguments.

    Invalid argument'type. Expecting'a Record value, but of a different schema
    Incompatible type. The 'Id' column in the data source you're updating expects a 'Number' type
    and you're using a 'Error' type.
    and also
    "name isn't valid: ThisItem isn't recognised" (may have been there before and missed it, only shows when I hover over that part of the formula.
  • zizzer Profile Picture
    29 on at

    Ok, using your code worked- I havent quite got it solved 100% but getting there...

    so because the Gallery for Activity is a collection I had to find what the collection was calling the activity data. Once that was inserted it worked.

    I am now trying to figure out the same thing for the Participant line- as currently it patches an item with only the activity data, not the participant- which is also from a collection... I'l try and figure that out and if need revert to data directly from the list and troubleshoot from there.

    Thanks! If I get stuck again I'll update here.

    Appreciate the help *alot*

  • zizzer Profile Picture
    29 on at

    Ok, the full code is working, here it is if it helps anyone else going through a similar challenge:

    ForAll(

        ComboBox3.SelectedItems,

        Patch(

            'Conjunctions',

            Defaults('Conjunctions'),

            {

                Participant: {Id: Value(ThisRecord.ID), Value: ThisRecord.'Title'},

                Activity: {Id: RecordsGallery1_5.Selected.ID, Value: RecordsGallery1_5.Selected.'FirstItemTitle'}

            }

        )

    )

    I changed 'thisitem' to 'this record'.

    @mmbr1606 thanks again, one other question- it now creates duplicates of the same combination of participant and event if they are accidently resubmitted- trying to stop this I tried:

    ForAll(
        ComboBox3.SelectedItems,
        If(
            IsEmpty(LookUp('Conjunctions', Value(ThisRecord.ID) = 'Participant: ID' && 'Activity: ID' = RecordsGallery1_5.Selected.ID)),
            Patch(
                'Conjunctions',
                Defaults('Conjunctions'),
                {
                    'Participant: ID': {Id: Value(ThisRecord.ID), Value: ThisRecord.Title},
                    'Activity: ID': {Id: RecordsGallery1_5.Selected.ID, Value: RecordsGallery1_5.Selected.FirstItemTitle}
                }
            )
        )
    );
    (but this is no good as it expects a table not a record- i think as it's a lookup?

    and I also tried created a collection and cross referencing that way.

    If you have any idea how to stop duplicates that would be awesome, but thanks for all the help already. It was very useful.

     

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 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard