cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ryang
Level: Powered On

Patch SharePoint List with Lookup field

I am having trouble using the Patch formula to write to a SharePoint list with a lookup field.

 

I attempted to use the following thread as a guide but I am still receiving an error:
https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/How-to-patch-a-SharePoint-Lookup-Co...

My formula:
Patch(
Booking,
Defaults(Booking),
{
Title: "Test",
BookingDate: BookingDateDP.SelectedDate,
Routes:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
ID:RouteDD.Selected.ID,
Title:RouteDD.Selected.Title}
}
)

Error: Invalid argument type. Expecting a Record value, but of a different schema. Missing column. Your foumula is missing a column 'Id' with a type 'Number'. The function 'Patch' has some invalid arguments.

I am not entirely sure where I am going wrong, i tried using different combinations of {}, (), using Table forumula or Record formula


1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Patch SharePoint List with Lookup field

@ryang 

One more idea.  Many times the 2nd argument is called Value.  What happens if you change Title to value?

 

Routes:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:Value(RouteDD.Selected.ID),
Value:RouteDD.Selected.Title}
}

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Patch SharePoint List with Lookup field

@ryang 

Is it possible you need to change ID to Id due to case sensitivity?

 

 

My formula:
Patch(
Booking,
Defaults(Booking),
{
Title: "Test",
BookingDate: BookingDateDP.SelectedDate,
Routes:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:Value(RouteDD.Selected.ID),
Title:RouteDD.Selected.Title}
}
)

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

ryang
Level: Powered On

Re: Patch SharePoint List with Lookup field

I had attempted that as well, but SharePoint identity column is "ID"

Super User
Super User

Re: Patch SharePoint List with Lookup field

@ryang 

Did you also try wrapping the Id in a VALUE function like I did in the above example?

ryang
Level: Powered On

Re: Patch SharePoint List with Lookup field

Earlier i tried ID: Value(RouteDD.Selected.ID)

I now tried Id: Value(RouteDD.Selected.ID) but same error.

If i take out the entire section with Routes and only Patch Title and Booking Date, it works fine.

Super User
Super User

Re: Patch SharePoint List with Lookup field

@ryang 

One more idea.  Many times the 2nd argument is called Value.  What happens if you change Title to value?

 

Routes:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:Value(RouteDD.Selected.ID),
Value:RouteDD.Selected.Title}
}

View solution in original post

ryang
Level: Powered On

Re: Patch SharePoint List with Lookup field

Sorry, that was it. I miss read your reply. Thanks a million.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,878)