cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
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
Highlighted
Community Support
Community Support

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

7 REPLIES 7
Highlighted
Community Support
Community Support

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

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

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.
Highlighted

Thanks, that seems to work!

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

Highlighted

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.
Highlighted

@v-xida-msft 

 

Thanks for your comprehensive response to this post.. I think this will resolve my query also. However I'm struggling to replicate it as i have 3 screens and 3 forms New/View/Edit and not sure which one to put where in your instructions.. have tried different combinations but not getting it right ! 

 

I also have something different in sharepoint integration and not sure whether to add your bits on or replace? replacing doesn't seem to work but neither does adding on !🙄  so I'm obviously doing something completely wrong.

 

My screens/forms are as follows:

 

ScreenNew and  FormNew

ScreenView and  FormView

ScreenEdit and FormEdit

 

and here is what I currently have in sharepoint integration..

on New sharepoint 

Set(SharePointFormMode, "CreateForm"); NewForm(FormNew); Navigate(ScreenNew, ScreenTransition.None)

On edit

Set(SharePointFormMode, "EditForm"); EditForm(FormEdit); Navigate(ScreenEdit, ScreenTransition.None)

On view

Set(SharePointFormMode, "ShowForm"); ViewForm(FormView); Navigate(ScreenView, ScreenTransition.None)

 

 

My forms etc.. all work fine at the moment but I really want to achieve the duplication option as this list is used in a weekly report and I want the users to be able to duplicate last weeks entry (certain fields) and only have to fill in others..

 

many thanks

 

 

Highlighted
Frequent Visitor

It works well except for when the column I need to duplicate is a drop down or lookup.  How do I handle duplicating the data for an email lookup or dropdown? 

 

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

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

Top Solution Authors
Top Kudoed Authors
Users online (10,585)