cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Future_Vision
Post Prodigy
Post Prodigy

How do I make an edit form enter data as a new record?

I have 4 forms (Form1, Form 2, and Form 3) on a single screen. The values in these first 3forms populate Form 4 which is then submitted when the 'Submit' button is clicked. Now, these forms are always in edit mode regardless of whether I am creating a new record or editing one. I'm using a variable called glbFormData for this. This is set to Defaults(datasource) for a new record or has the values of a record for editing. What I am attempting to do is to build a 'copy' functionality. This is similar to editing a record but instead populating the forms with the saved record and submitting the changes as edits I want to submit the form as a new record. I haven't figured out quite yet. I've tried setting a 'copy' variable and changing the mode of the form to 'new' but that just removes all values from the fields. It seems like there should be a way to do this relatively easy. Something like

 

If varCopy = true then submit the form data as a new record else SubmitForm.

 

Make sense?

1 ACCEPTED SOLUTION

Accepted Solutions
Future_Vision
Post Prodigy
Post Prodigy

@RandyHayes I knew there had to be a much easier way to make a copy. Banging on it to see if falls down anywhere. 

 

Below is the code for other's reference. Replace recordID with the name of the column that holds the record's ID.

 

If(varCopy=true, Patch(glbFormData, Form1.Updates, Form2.Updates, Form3.Updates, {recordID:Blank()}), Patch(glbFormData, Form1.Updates, Form2.Updates, Form3.Updates))

 

View solution in original post

7 REPLIES 7
RandyHayes
Super User III
Super User III

@Future_Vision 

Change the Item property of your Master Form to the following:

   Patch(glbFormData, Form1.Updates, Form2.Updates, Form3.Updates, {ID:Blank()})

 

This will then create a duplicate record with the information from the first.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Future_Vision
Post Prodigy
Post Prodigy

@RandyHayes I knew there had to be a much easier way to make a copy. Banging on it to see if falls down anywhere. 

 

Below is the code for other's reference. Replace recordID with the name of the column that holds the record's ID.

 

If(varCopy=true, Patch(glbFormData, Form1.Updates, Form2.Updates, Form3.Updates, {recordID:Blank()}), Patch(glbFormData, Form1.Updates, Form2.Updates, Form3.Updates))

 

View solution in original post

Future_Vision
Post Prodigy
Post Prodigy

Just a quick note to anyone else trying this. Make sure you set varCopy back to false for edits. 

RandyHayes
Super User III
Super User III

@Future_Vision 

So this is not a SharePoint list then you are working with!?

 

Your global variable already holds the record ID, there is no need for another variable to hold it duplicated.

For a SharePoint list your formula should be the following:

Patch(glbFormData, Form1.Updates, Form2.Updates, Form3.Updates, If(varCopy, {ID:Blank()}, {}))
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Future_Vision
Post Prodigy
Post Prodigy

It isn't a Sharepoint list. I'm using Dataverse(CDS).

RandyHayes
Super User III
Super User III

@Future_Vision 

Yep, figured that...just wanted to post the formula for others in case they were using SharePoint as in SharePoint, it is the ID that needs to be "blanked".

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Great. Then I am all set with my formula. Much appreciated!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,261)