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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (64,389)