cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft juphi17
Microsoft

Duplicating an item / Copying existing data to a New record?

I have a Sharepoint List Form customized in PowerApps. I would like an easy way for someone to 'duplicate' a record.

At the top of the form I put a button labelled 'Duplicate' that is only visible when the Form is in 'View' mode.

 

When the user clicks that button, I want the Form to go into New Mode and copy most of the values from the record they were just viewing (basically all the fields minus the ID). 

 

What is the best way to do this? Any help is greatly appreciated. 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Duplicating an item / Copying existing data to a New record?

Hi @juphi17 ,

Do you want to duplicate a record when you view an existing record in your SP List using PowerApps custom form?

How many Edit forms do you add in your custom form app? Only the single one?

 

Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

Set the Visible property of the 'Duplicate' button to following:

If(
   SharePointForm1.Mode = FormMode.View,
   true,
   false
)

Set the OnSelect property of the 'Duplicate' button to following:

Set(CurrentItem, SharePointIntegration.Selected); // or Set(CurrentItem, LookUp('SP List', ID = SharePointIntegration.SelectedListItemID))
ResetForm(SharePointForm1);
NewForm(SharePointForm1)

 

Set the Default property of the Column1 Text Box field within your Edit form to following:

If(
   !IsBlank(CurrentItem),
   CurrentItem.Column1,
   Parent.Default
)

Set the Default property of the Column2 Text Box field within your Edit form to following:

If(
   !IsBlank(CurrentItem),
   CurrentItem.Column2,
   Parent.Default
)

Set the Default property of the Column3 Text Box field within your Edit form to following:

If(
   !IsBlank(CurrentItem),
   CurrentItem.Column3,
   Parent.Default
)

...

...

 

Set the OnNew property of SharePointIntegration control to following:

Set(CurrentItem, Blank());
Refresh('SP List')
NewForm(SharePointForm1)

Set the OnEdit property of the SharePointIntegration control to following:

Set(CurrentItem, Blank());
Refresh('SP List')
EditForm(SharePointForm1)

Set the OnView property of the SharePointIntegration control to following:

Set(CurrentItem, Blank());
Refresh('SP List')
ViewForm(SharePointForm1)

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

5 REPLIES 5
Community Support Team
Community Support Team

Re: Duplicating an item / Copying existing data to a New record?

Hi @juphi17 ,

Do you want to duplicate a record when you view an existing record in your SP List using PowerApps custom form?

How many Edit forms do you add in your custom form app? Only the single one?

 

Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

Set the Visible property of the 'Duplicate' button to following:

If(
   SharePointForm1.Mode = FormMode.View,
   true,
   false
)

Set the OnSelect property of the 'Duplicate' button to following:

Set(CurrentItem, SharePointIntegration.Selected); // or Set(CurrentItem, LookUp('SP List', ID = SharePointIntegration.SelectedListItemID))
ResetForm(SharePointForm1);
NewForm(SharePointForm1)

 

Set the Default property of the Column1 Text Box field within your Edit form to following:

If(
   !IsBlank(CurrentItem),
   CurrentItem.Column1,
   Parent.Default
)

Set the Default property of the Column2 Text Box field within your Edit form to following:

If(
   !IsBlank(CurrentItem),
   CurrentItem.Column2,
   Parent.Default
)

Set the Default property of the Column3 Text Box field within your Edit form to following:

If(
   !IsBlank(CurrentItem),
   CurrentItem.Column3,
   Parent.Default
)

...

...

 

Set the OnNew property of SharePointIntegration control to following:

Set(CurrentItem, Blank());
Refresh('SP List')
NewForm(SharePointForm1)

Set the OnEdit property of the SharePointIntegration control to following:

Set(CurrentItem, Blank());
Refresh('SP List')
EditForm(SharePointForm1)

Set the OnView property of the SharePointIntegration control to following:

Set(CurrentItem, Blank());
Refresh('SP List')
ViewForm(SharePointForm1)

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

Microsoft juphi17
Microsoft

Re: Duplicating an item / Copying existing data to a New record?

This works amazing, but one big issue:

When I click the 'Duplicate' button - the form successfully goes into New mode and copies all the values over successfully. BUT the PowerApps toolbar in the SharePoint window does not allow to Save the new form, it still says 'Edit all'. New forms are supposed to have 'Save' and 'Cancel'.  When I click 'Edit all' it goes into Edit mode for the previous record that I was trying to duplicate.

 

Would you know how to fix this so the 'Save/Cancel' buttons appear?   Maybe the ID is being copied over somehow?

Highlighted
Community Support Team
Community Support Team

Re: Duplicating an item / Copying existing data to a New record?

Hi @juphi17 , 

Actually, it is an known issue within SharePoint list -- the button options within the SharePoint window would not change based on the custom form mode.

Note: The button options (e.g. "Edit all") in SharePoint window is belong to SharePoint itself rather than custom form app. 

 

As an alternative solution, you could consider add a custom button (called "Save Record") on your custom form screen, set the OnSelect property to following:

SubmitForm(SharePointForm1)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

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

Re: Duplicating an item / Copying existing data to a New record?

Thanks, that seems to work!

Is there a way to hide that SharePoint toolbar to avoid users running into that bug?

Community Support Team
Community Support Team

Re: Duplicating an item / Copying existing data to a New record?

Hi @juphi17 ,

Currently, there is no way to hide that SharePoint toolbar option buttons within PowerApps app. If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

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

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,216)