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

Copy existing item and submit as new item on SharePoint

Hi everyone,

 

I have a PowerApps form created from a SharePoint list. The requirement is:

 

  1. A user has selected an item from SharePoint and launched the PowerApps form (now in Edit Mode)
  2. There is a checkbox or button which asks the user if they want to submit/save the form as a new item on SharePoint or update the existing item (all previous values are carried over).

 

Could anyone advise?

 

Best regards,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Copy existing item and submit as new item on SharePoint

You could add a "Save as New" button on the form and use the Patch() to create the new item in SharePoint. Along with the Patch() you would need to reset the form and close it.

 

Example formula for the button:

Patch('SPOListName', Defaults('SPOListName'), {SPOFieldName1:CopyValue1 , SPOFieldName2:CopyValue2, ...});

ResetForm(SharePointForm1);
RequestHide()

 

You will need to call out each field that you are going to set in the new record in the {....} of the Patch().



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Copy existing item and submit as new item on SharePoint

You could add a "Save as New" button on the form and use the Patch() to create the new item in SharePoint. Along with the Patch() you would need to reset the form and close it.

 

Example formula for the button:

Patch('SPOListName', Defaults('SPOListName'), {SPOFieldName1:CopyValue1 , SPOFieldName2:CopyValue2, ...});

ResetForm(SharePointForm1);
RequestHide()

 

You will need to call out each field that you are going to set in the new record in the {....} of the Patch().



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

Highlighted
Helper I
Helper I

Re: Copy existing item and submit as new item on SharePoint

Thank you so much for this and for your prompt response. Working exactly as instructed.

Highlighted
Frequent Visitor

Re: Copy existing item and submit as new item on SharePoint

When I copy an existing record and save as new item, the existing values on that form don't appear in the Sharepoint under the new item - only the changed values appear there.

 

How can I fix this? I set the clone to be a new form to differentiate it from the edit. CFSC Forecasting Tool is the name of my Sharepoint list and there are a few cascading dropdowns hence why I have used @odata.type'

 

This is my code:

If(New=true,
Patch(
'CFSC Forecasting Tool',
Defaults('CFSC Forecasting Tool'),
{
Title:DataCardValue6.Text,
CDT:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:filterCDT},
Banner:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:filterBanner},
Category:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:filterCategory},
StartDate:DataCardValue12.SelectedDate,
EndDate:DataCardValue13.SelectedDate,
PromoCreatedBy:DataCardValue11.Selected,
Status: DataCardValue34.Selected,
Comments:DataCardValue39.Text
}
),
Patch(
'CFSC Forecasting Tool',
LookUp('CFSC Forecasting Tool', ID=DataCardValue10.Text),
{
Title:DataCardValue6.Text,
CDT:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:filterCDT},
Banner:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:filterBanner},
Category:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:filterCategory},
StartDate:DataCardValue12.SelectedDate,
EndDate:DataCardValue13.SelectedDate,
PromoCreatedBy:DataCardValue11.Selected,
Status: DataCardValue34.Selected,
Comments:DataCardValue39.Text
}
)
);
ResetForm(EditForm1);Back()

Helpful resources

Announcements
Check this Out

Announcing

Class of 2020- Season 2

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,662)