Skip to main content
Community site session details

Community site session details

Session Id : 3KxFsCY1q2he0740ap3qPN
Power Apps - Building Power Apps
Answered

Patch a LookUp column in a gallery with a combobox

Like (0) ShareShare
ReportReport
Posted on 11 Mar 2020 09:34:31 by

Hi all,

 

With the help from this thread (https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-patch-a-SharePoint-Lookup-Column/td-p/24094) I have used the following patch() function in the ONCHANGE propert of the combobox2:

 

Patch('Project Costs Consultants Weekly Work',
 ThisItem,
 {Consultant:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
 Id:ProjectCostsGallery.Selected.ID,
 Value:ComboBox2.Selected.'Name ({Name})'}
 }
 )

 

However, it seems that it does not work. Whenever I choose a name from the Combobox2 (which is connected to an employeelist) it does not patch the name into the "Consultant"-column. Ideally, what I would like to happen is to choose a name, the "Consultant" tab changes to that name AND it drags the corresponding "Daily Price" and "Daily Cost" from that employee:

 

LookUpPatch1.JPG

 

The "Consultant" column is a LookUp column, which has many different columns dragged into this List among which are the "Daily Cost" and "Daily Price".

 

Is this possible?

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    on 18 Mar 2020 at 08:46:20
    Re: Patch a LookUp column in a gallery with a combobox

    Hi @Anonymous ,

    Based on the formula that you mentioned, I think there is something wrong with the value you provided for the Id property under the Consultant field.

     

    The Id property under the Consultant field should be provided with ID value from your 'Employee List SPM' rather than your 'Project Costs Consultants Weekly Work' List.

     

    Please consider modify your formula as below:

    Patch(
     'Project Costs Consultants Weekly Work',
     ThisItem,
     {
     Consultant: {
     Id: LookUp('Employee List SPM', Name = ComboBox2.Selected.Name, ID),
     Value: ComboBox2.Selected.Name
     }
     }
    )

    Set the Items property of the ComboBox2 to following:

    'Employee List SPM'.Name

     

    Please take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    on 16 Mar 2020 at 07:00:32
    Re: Patch a LookUp column in a gallery with a combobox

    @WarrenBelz  thanks for the tag, I'll give this tricky one a try.

     

    @Anonymous 

    Can you try this

    Patch('Project Costs Consultants Weekly Work',
     ThisItem,
     {Consultant:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id:LookUp(lookupListName, 'Name ({Name})' = ComboBox2.Selected.'Name ({Name})',ID),
     Value:ComboBox2.Selected.'Name ({Name})'}
     }
     )

    Notes:

    1. lookupListName is the SP List that the LookUp column is referencing

    2. 'Name ({Name})' may not be 100% correct, it may just be 'Name'? Just play around with it to see what works.

     

     

    Let me know how you get on

     

  • WarrenBelz Profile Picture
    148,887 Most Valuable Professional on 16 Mar 2020 at 04:59:14
    Re: Patch a LookUp column in a gallery with a combobox

    HI @Anonymous ,

    I will tag another colleague @Anonymous to see if he has any ideas.

  • Community Power Platform Member Profile Picture
    on 12 Mar 2020 at 21:31:58
    Re: Patch a LookUp column in a gallery with a combobox

    Bumping and crossing fingers someone can help with this problem. Still no luck unfortunately 😞

     

    @CarlosFigueirawould you have a chance to take a look at this?

  • Community Power Platform Member Profile Picture
    on 11 Mar 2020 at 12:16:44
    Re: Patch a LookUp column in a gallery with a combobox

    @WarrenBelzHave a good night and thank you for the effort!

     

    Crossing fingers @mdevaney has the time to help 🙂

  • WarrenBelz Profile Picture
    148,887 Most Valuable Professional on 11 Mar 2020 at 12:11:18
    Re: Patch a LookUp column in a gallery with a combobox

    Thanks @Anonymous ,

    I will do what I always do when something works for me and not for you - call in one of my code guru colleagues @mdevaney   - my time zone will take me offline shortly (late night here) - he will just be having breakfast.

  • Community Power Platform Member Profile Picture
    on 11 Mar 2020 at 12:00:36
    Re: Patch a LookUp column in a gallery with a combobox

     @WarrenBelz 

     

    Sorry, no luck. I just changed the column to "Employee" and nothing has changed. I get an error when I change the Items Property to:

    Choices([@'Employee List SPM'].Employee) /Choices([@'Employee List SPM'].Name)/Choices([@'Employee List SPM'].etc)

     

     

  • WarrenBelz Profile Picture
    148,887 Most Valuable Professional on 11 Mar 2020 at 11:46:06
    Re: Patch a LookUp column in a gallery with a combobox

    Ok @Anonymous ,

    That may be the reason for the no result - you should not use "reserved" words like Name as anything (field, list, control or variable) as it becomes ambiguous to PowerApps and it may initiate something completely different from what you intend.

    However the Items of the ComboBox should be something like

    Choices([@'Employee List SPM'].Name)
  • Community Power Platform Member Profile Picture
    on 11 Mar 2020 at 11:33:08
    Re: Patch a LookUp column in a gallery with a combobox

    @WarrenBelz, I agree, in hindsight this should be more generic.

     

    The items property is basically: 'Employee List SPM'.Name

     

    I am essentially intending to choose one of the employees from our list

  • WarrenBelz Profile Picture
    148,887 Most Valuable Professional on 11 Mar 2020 at 11:24:52
    Re: Patch a LookUp column in a gallery with a combobox

    OK @Anonymous ,

    Nothing unusual there except Name is a very bad name for a field - what is the Items property of ComboBox2?

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete