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. 🙂
Solved! Go to Solution.
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,
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,
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?
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,
Thanks, that seems to work!
Is there a way to hide that SharePoint toolbar to avoid users running into that bug?
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,
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
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
)
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
203 | |
187 | |
82 | |
50 | |
37 |
User | Count |
---|---|
290 | |
243 | |
123 | |
74 | |
56 |