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

New Record Part Patch, Part Data Table

Hi ,

 

I've a bit of a difficult one to explain, I want to Patch some fields manually instead of using the typical wizard data card because I am having a major ache with the datacards rearranging.

I can achieve this fine when I am editting an existing record but when I want to create a new record I am unable of finding a way to patch as I'm previously using...

Patch(TicketLog, BrowseGallery_3.Selected , 
{Kit_for_Site_1: txt_Kit_required_1.Text, 
Kit_for_Site_2: txt_Kit_required_2.Text,  
Kit_for_Site_3: txt_Kit_required_3.Text, 
Kit_for_Site_4: txt_Kit_required_4.Text, 
Kit_for_Site_5: txt_Kit_required_5.Text});

which obviously selects the gallery record.

I thought "ThisItem" should work but that gives me a "Recognize" error.

Any help would be greatly appreciated

3 REPLIES 3
Super User
Super User

Re: New Record Part Patch, Part Data Table

If you want to create a new record you just need to change the second parameter of the patch function. Instead of BrowseGallery_3.Selected to update an existing record you need Defaults(TicketLog) to create a new record.

 

Patch(TicketLog, Defaults(TicketLog) ,
{Kit_for_Site_1: txt_Kit_required_1.Text,
Kit_for_Site_2: txt_Kit_required_2.Text,
Kit_for_Site_3: txt_Kit_required_3.Text,
Kit_for_Site_4: txt_Kit_required_4.Text,
Kit_for_Site_5: txt_Kit_required_5.Text});



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
v-siky-msft
Level 8

Re: New Record Part Patch, Part Data Table

Hi, @Ashers82 ,

 

To solve your problem, you should use Patch with the Defaults function to create new records as below.

Patch( Customers, Defaults( Customer ), { Name: “Contoso” } )

 So you need to modify the second parameter of Patch function in your formula. Use Defaults(TicketLog)  instead of BrowseGallery_3.Selected .

The formula should be like this:

Patch(TicketLog, Defaults(TicketLog) ,
{Kit_for_Site_1: txt_Kit_required_1.Text,
Kit_for_Site_2: txt_Kit_required_2.Text,
Kit_for_Site_3: txt_Kit_required_3.Text,
Kit_for_Site_4: txt_Kit_required_4.Text,
Kit_for_Site_5: txt_Kit_required_5.Text});

For more information, please refer to the doc: Patch function

 

Best regards,

Sik

Ashers82
Level: Powered On

Re: New Record Part Patch, Part Data Table

Thank you for the reply however when I do this I get two new records on the basis that I already have about 20 other fields being created using the datafield method.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 92 members 3,674 guests
Please welcome our newest community members: