cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Re: Error Creating a record using Patch

You are right. I finally opened PowerApps to solve this properly instead of guessing. Sorry. 

 

This is what works in my test:

Patch(Employees, Defaults(Employees), {Title: "VP", FirstName: "Button" })

 

So I think for you this is:

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

 

Which is what it looks like you tried to start. So what about this?

Patch(toolsweeklyverification, Defaults(toolsweeklyverification), {bwtoolnumber: "Test"})

 

Does that work?

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 tried that but no success and still the same error.

 

Did you add Gallery and set the data source to the SharePoint list 'Employess'?

 

Super User
Super User

Re: Error Creating a record using Patch

I did but that should not matter. 

 

How about this?

 

Patch(toolsweeklyverification, Defaults(toolsweeklyverification), {Title: "Test", bwtoolnumber: "Test"})

 

If that doesn't work then if I was you I would create a new list with just one or two columns and play with Patch. Something silly is tripping you up here. 

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

In fact, I did create a new SharePoint list but I will do that again andthis time with only one column and see what happens.

Will keep you posted.

Thanks for your time and support.

Anonymous
Not applicable

Re: Error Creating a record using Patch

I think the culprit is Title. By default each SharePoint list has Title as a required field. 

I did a test on a fresh SharePoint list first with one filed and it would not work but I remebered about reading that if you don not provide a required fieild, Patch will not work. Hence, I just added Title column as "" and it added record to the list.

Now I will try on my toolsweeklyverification list and see what happens.

 

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

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 (Last 30 Days)
Users online (6,626)