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

How to patch a SharePoint Lookup Column

I can update all other SharPoint fields using the Patch function, but I am unsucessful in udpating lookup columns using a button.

 

I have a Customers list and a Projects list and I am trying to patch the ID of the Customer into the Projects list which has a lookup column to the Customers list ( column ID).

 

This is my function which is connected to the button -

 

Patch(Projects,{Title: Gallery.Selected.Title, CustomerID: Gallery.Selected.ID})

 

The error message I get is 'The type of this record does not match the expected type 'Record.' Found type 'Number'.

14 REPLIES 14

Well, I tried and I just couldn't get it to work.  So I decided on a diffrent strategy.   Instead of trying to set it to blank, set it to a default value and then enter that default value into the source table the lookup column is based on.  Works like a charm...

hello, @v-micsh-msft 

 

I have a simular case. (Patch to lookup columns in sharepointlist.) 

The user selects an item in the browsegallery and he will be navigate to an editform. 

Because I changed the item function of the dropdowns in the editform, the submitform function doesn't work any more. (I suppose that's the reason. )  

 

I tried to use your formula but there is still something wrong. This is what I use on the onselect function from an icon (to save) 

A second question is how to use it for multiple dropdowns. This editform has 4 dropdowns each to patch to a lookup column.

 

 

Navigate('Screen CMT NIV 3';ScreenTransition.None) ;;
Patch('CMT Niveau 3';
'BrowseGallery CMT Niv3'.Selected; 
{Lookup:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
Id:'BrowseGallery CMT Niv3'.Selected.Id;
Value:'BrowseGallery CMT Niv3'.Selected.'B-TO'.Value }
}
)

I figured out to Filter The choices of the dropdown based on the value in another list. 

Then I could use submitform again and i don't have to patch. 

 

 

I know this thread is many years old, but in googling the issue it was still the first hit. I think the available solutions have improved since this discussion happened. It seems the original solution is constructing a record meant to match the lookup. Instead of doing that, you can lookup the actual record.

 

Patch(Projects, Lookup(Projects, Gallery.Selected.ID, ID.Value = Gallery.Selected.ID, Project));

 

This should work for both Sharepoint Lookup columns and Sharepoint Choice columns. For Choice columns, this is your only option because the records only exist inside this column in the larger list. For Lookup, you could also instead lookup directly from the lookup list.

Anonymous
Not applicable

Hi @v-micsh-msft!

 

I am currently trying to patch a column on sharepoint that is a yes or no choice column. If the button is clicked, I want the column on sharepoint to output a yes. 

Currently, my unfinished code is: Patch('Routings Needed',LookUp('Routings Needed',ID=DataCardValue7), {'BOM Reviewed?': {

Where I want the ID is based on a unique ID in powerapps. How could I finish this code?

Thank you in advance for your help.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,036)