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

DataSource GUID not auto-generated when creating a new record using the Patch function

I'm trying to create a new record in a table (SQL database) named Test1 using the Patch() command in powerapps:

 

Patch('[dbo].[Test1]',Defaults('[dbo].[Test1]'),{Name:"Tony",flag:1})

 

The ID column (primary key) of this table implements a GUID. Implementing above function syntax gives an error message that the ID Field is required:

 

PowerApp_Patch_function.png

 

From the documentation the ID GUID in the source table should be updated automatically when executing the Patch function.

The same happens when the uniqueidentifier is not set as a GUID.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: DataSource GUID not auto-generated when creating a new record using the Patch function

Hi @Anonymous,

 

Could you please share about the column property of the ID column in your SQL table?

If the ID column is set to Primary Key (should means the uniqueidentifier ) with identity specification set to YES, then when using Patch function, there is no need to specify this column data under the patch function, 

If the ID column is set to Primary Key, but didn't configure the identity specification, then this column value must be specified when using the Patch function.

84.PNG

85.PNG

86.PNG

By the way, could you please share the documentation for " ID GUID in the source table should be updated automatically when executing the Patch function." ?

Is it the following article?

Patch function in PowerApps

If you mean the ID mentioned in the Example part, I should make it clear that the ID is generated by the Data source automatically, which means the ID column should be able to set to auto generate value from the data source side.

 

If you have any further questions, or if I have any misunderstandings, please post back.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: DataSource GUID not auto-generated when creating a new record using the Patch function

Hi @Anonymous,

 

Could you please share about the column property of the ID column in your SQL table?

If the ID column is set to Primary Key (should means the uniqueidentifier ) with identity specification set to YES, then when using Patch function, there is no need to specify this column data under the patch function, 

If the ID column is set to Primary Key, but didn't configure the identity specification, then this column value must be specified when using the Patch function.

84.PNG

85.PNG

86.PNG

By the way, could you please share the documentation for " ID GUID in the source table should be updated automatically when executing the Patch function." ?

Is it the following article?

Patch function in PowerApps

If you mean the ID mentioned in the Example part, I should make it clear that the ID is generated by the Data source automatically, which means the ID column should be able to set to auto generate value from the data source side.

 

If you have any further questions, or if I have any misunderstandings, please post back.

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Community Support Team
Community Support Team

Re: DataSource GUID not auto-generated when creating a new record using the Patch function

Hi @Anonymous,

 

Do you need any further help on this issue?

 

Regards

Michael

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

Re: DataSource GUID not auto-generated when creating a new record using the Patch function

Refer to this question for a solution if you are trying to create a new record in SQL where the primary key is a 'uniqueidentifier' or GUID and has a default value of (newid()).

Basically, you need to use the PATCH function to create the new record, you can't create a new record with the PowerApp Submit Form method.

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: 350 members 6,649 guests
Recent signins:
Please welcome our newest community members: