cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

How to create a copy of an existing item

I need to create a "copy item" on a typical auto-generated three-form data source (list, detail, edit forms) connected to a SP list.

 

The Process is as following:

 

1) User has selected a certain item, and is now on the DetailForm.

2) User click a "Copy Item" icon

3) App copies over the fields values from the selected old item to the newly created one.(Create new and not overwrite the current one)

4) App shows the EditForm to edit the newly created item (form would be in FormMode.New).

 

here is the on select formula I used :

 

NewForm(Form2); Form2.Mode = FormMode.New; Navigate(Edit, ScreenTransition.None)

but actually it is not working it is just give me a new blank form not coping any field. 

6 REPLIES 6
Highlighted
Community Support
Community Support

Hi @gme-eg ,

 

This is because that you have used NewForm function and when in new form mode, Form control will only create a new item. Please use below formula instead:

In the OnSelect property of the copy button:

Patch(ListName,Defaults(ListName),{Title:DataCardValue1.Text,Choice:DataCardValue2.Selected,...});EditForm(Form2);Navigate(Edit, ScreenTransition.None)

 

Then set the Item property of Form2 to:

Last(ListName)

 

Regards,

Mona

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

Thanks a lot for your support I tried but I got error there is something not clear for me what do you mean by or should I put the data cards of my form that I want to copy it.

;  (Title:DataCardValue1.Text,Choice:DataCardValue2.Selected,..)

Patch(ListName,Defaults(ListName),{Title:DataCardValue1.Text,Choice:DataCardValue2.Selected,...});EditForm(Form2);Navigate(Edit, ScreenTransition.None)

 Please find below is a screenshot from my details screen:

Details Screen.png

Highlighted

anyone can help please

Highlighted

Highlighted

@Ashish2012 thanks a lot I tried but the function is not coping Items it makes a new item, I used this :

 

Spoiler
NewForm(Form2); FormMode.Edit=FormMode.New; Navigate(Edit, ScreenTransition.None)

 @v-monli-msft

Highlighted

anyone can help as I stacked in this issue for weeks

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Users online (9,256)