cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Error Creating a record using Patch

I am writing an app that captures user input and appends the SharePoint list. In app, I have added Gallery and pointed it data source to toolsweeklyverification SharePoint list. OnSelect property of the button has Patch(toolsweeklyverification,Defaults(toolsweeklyverification),{bwtoolnumber:txtBWToolNumber.Text}). Somehow this does not work. I get error: The type of this argument bwtoolnumber does not match the expected type 'Record'. Found type' Text' I also tried collect but the same error. What am I doing wrong? Thanks.
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Error Creating a record using Patch

Here is my OnSelect command syntax:

UpdateContext({AddRecord:Patch(toolsweeklyverification, Defaults(toolsweeklyverification), {Title: "", bwtoolnumber: txtBWToolNumber.Text})})

 

Lesson learned: Do NOT skip required field.

View solution in original post

16 REPLIES 16
Super User
Super User

Re: Error Creating a record using Patch

What type of column is bwtoolnumber in SharePoint? 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Anonymous
Not applicable

Re: Error Creating a record using Patch

Single line of text. I tried to follow example at https://powerusers.microsoft.com/t5/PowerApps-Community-Blog/Building-PowerApps-from-scratch-Use-Pat... Thanks for help.
Super User
Super User

Re: Error Creating a record using Patch

Hi @Anonymous

 

Is bwtoolnumber a lookup column? If so, the formula in this post might help you.

 

https://powerusers.microsoft.com/t5/General-Discussion/How-to-patch-a-SharePoint-Lookup-Column/m-p/24094/highlight/true#M10368

 

Anonymous
Not applicable

Re: Error Creating a record using Patch

Is bwtoolnumber a lookup column? If so, the formula in this post might help you. It is a single line of text.
Super User
Super User

Re: Error Creating a record using Patch

 I would double check. Your error tells me it is a choice or lookup or something different in SharePoint. What you have should work for a text column. 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Anonymous
Not applicable

Re: Error Creating a record using Patch

I have attached the screenshot of the definition of all the columns. It is single line of text.
Super User
Super User

Re: Error Creating a record using Patch

What if you try

 

Patch(toolsweeklyverification,{bwtoolnumber:txtBWToolNumber.Text})

 

Does that work? 

 

BTW - I am about to record a video on Patch and SharePoint. You are the second one to ask about related today. 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Anonymous
Not applicable

Re: Error Creating a record using Patch

I will try that and keep you posted. I was searching on google for the error and came across a post that mentioned that patch would not work because there is not constructor or something like that. If I find that post, I will post an update here, mean while I will try your suggestion and let you know. Thanks again,
Anonymous
Not applicable

Re: Error Creating a record using Patch

I get the same 'Record' error with your syntax.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,559)