cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ashers82
Frequent Visitor

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
Jeff_Thorpe
Super User
Super User

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
Community Support
Community Support

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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (76,513)