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

Not able to patch a lookup value

Hi all,

 

I'm having problems with a form that patches several columns to a SharePoint list. The problem lies at all the lookup columns in that list. In the examples that I will give below, I'm only using one lookup but I get the same error with all of them. I also added a screenshot as attachment.

 

Error:
- Invalid argument type. Expecting a Record value, but of a different schema.

- Missing column. Your formula is missing a column 'Id' with a type of 'Number'.

- The function 'Patch' has some invalid arguments

 

The patch functions that I tried:

 

Patch(Workspaces, {Id:Blank()},{Title:"Test",Department:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id: Dropdown1.Selected.Id,Value: Dropdown1.Selected.Titel}})
Patch(Workspaces, {Id:Blank()},{Title:"Test",Department:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:LookUp('Department abbreviations',Id = Dropdown1.Selected.Id,Id),Value:LookUp('Department abbreviations',Id = Dropdown1.Selected.Id,Titel)}})

 

 

And almost every scenario to make sure there is no difference between Id < > ID and Title < > Titel (dutch for Title)

 

The weird thing is that I created this app on our dev environment (where it worked), used the export/import action to get it to our acceptance (where it worked) and used the export/import to get it to production (where it doesn't work). So I know that the Patch function at a certain point did work.

 

If we look at the back-end:

On our 3 environments (dev, acceptance, production), the back-end was created using a PowerShell script. So the columns that are created are exactly the same. Did notice that on our production environment the display names did not came through so I did that manually (don't know if that could have something to do with this problem).

I've tried creating a lookup column manually => Same issue

I wanted to make sure the export/import wasn't causing this so I created a new app with a simple button on it => Same issue

 

If you need more information/screenshots, always happy to provide them.

 

I really hope that I'm missing something obvious... 🙂

 

Thanks!

2 REPLIES 2
Community Support Team
Community Support Team

Re: Not able to patch a lookup value

Hi @JanV ,

Could you please share a bit more about your issue?

Do you want to patch data into the LookUp field in your SP list based on the selected value in your Dropdown box?

Further, could you please share a bit more about the formula typed within the Items proeprty of your Dropdown box?

 

Based on the formula that you provided, I think there is something wrong with it. I have made a test on my side, please take a try to modify your formula as below:

Patch(
Workspaces,
Defaults(Workspaces),
{
Title:"Test",
Department: {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: LookUp('ReferencedSPList', ReferencedColumn = Dropdown1.Selected.Value, ID),
Dropdown1.Selected.Value
}
}
)

Note: The Department is a LookUp column in your Workspaces SP list, which lookup values from ReferencedColumn in your ReferencedSPList.

More details about saving data into LookUp column of SP list, please check and see if the response within the following threads would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/Cascading-Drop-Down-Result-not-saving/m-p/239...

https://powerusers.microsoft.com/t5/General-Discussion/Save-Filtered-Lookup-Value-in-List-Custom-For...

https://powerusers.microsoft.com/t5/General-Discussion/How-to-patch-a-SP-List-B-Lookup-column-of-SP-...

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
JanV
Level: Powered On

Re: Not able to patch a lookup value

Thanks for the reply.

Your formula does not work either. Getting the same errors.

My ddlDepartment dropdown is getting its items from a datasource:

'Department abbreviations'

 I already found a workaround by using a hidden form instead of the patch function: https://www.youtube.com/watch?v=YIoFyFQuC_c

But I still want to know what went wrong with my patch function.

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 104 members 5,268 guests
Please welcome our newest community members: