cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Slashglp222
Frequent Visitor

Patch to Look column with value but patched blank

Hello

 

I'm making an interactive floor map where a user can click a location button and assign the selected gallery item that location

 

Patch(
    Teams,
    PeoplePicker.Selected,
    {
           LocationLookup:   {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:PeoplePicker.Selected.ID,
                        Value:Gallery2.Selected.Location}
              }
         )

 

This patched the SP column to blank for some reason. It works when the patched column is a choice rather than lookup, can anyone help?

1 ACCEPTED SOLUTION

Accepted Solutions
zaphod88
Responsive Resident
Responsive Resident

So LocationLookUp looks up to the location list, right? Might this one be working? If your users choose a location in Gallery2, you need to patch the lookup column with its Id and Value, not with the one from PeoplePicker.

Patch(
    Teams,
    PeoplePicker.Selected,
    {
           LocationLookup:   {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:Gallery2.Selected.ID,
                        Value:Gallery2.Selected.Location}
              }
         )

 

View solution in original post

4 REPLIES 4
zaphod88
Responsive Resident
Responsive Resident

Your LookUp Id and Value are coming from different sources. In the list that this lookup is bound to, is there an item that has this Id and Value? Otherwise, you have to patch the lookup source list before to create a corresponding item there before you create the lookup.

So I have a Teams list, then a location list which has locations and coordinates. I then made a lookup column in the teams list so that each member of staff has a location that can be tied to the coordinate if that makes sense?

 

When changing the location, the data is coming from the locations list and then patching to the lookup in the teams list. 

previously I had a choice column in the teams list with corresponding data and this patch worked, but decided to change to a lookup to get the coordinates data for each staff member.

zaphod88
Responsive Resident
Responsive Resident

So LocationLookUp looks up to the location list, right? Might this one be working? If your users choose a location in Gallery2, you need to patch the lookup column with its Id and Value, not with the one from PeoplePicker.

Patch(
    Teams,
    PeoplePicker.Selected,
    {
           LocationLookup:   {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:Gallery2.Selected.ID,
                        Value:Gallery2.Selected.Location}
              }
         )

 

View solution in original post

Nice, thank you so much.

 

In my head I was thinking the ID part had to be the ID of the column I wanted to patch!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,421)