cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Copy an existing item and open in edit form for the user to save it.

Hi All,

i have a small requirement. i have a sharepoint customized form built in power apps. Now the user wants to copy that item in edit form and make a new copy and open the new copy in edit form and save that item after making changes in the copied item.
How can i achieve that?

Note: i am using a power apps form and not a canvas application so there is no gallery over here.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Do you want to copy an existing item within your custom form app, and make some changes to the copied item?

 

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

Add a "Copy" button within your Edit form (SharePointForm1) screen, set the Visible property to following:

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

set the OnSelect property of the "Copy" button to following:

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

 

Set the Item property of the SharePointForm1 to following:

If(
       IsBlank(SharePointIntegration.Selected.Executor.Claims) || IsEmpty(SharePointIntegration.Selected),
       First([@'Your SP List']),   // replace here with your actual SP List name
       SharePointIntegration.Selected
)

 

Set the OnSuccess property of SharePointForm1 to following:

Set(CopiedItem, Blank());   // Clear the CopiedItem variable
ResetForm(SharePointForm1);
RequestHide()

 

Set the Default property of the Text Input boxes within your SharePointForm1 to following:

If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.ColumnName1
)
If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.ColumnName2
)
If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.ColumnName3
)

....

same logic formula should be applied to all fields (Text fields, Choice fields, Date fields, ... etc) within your Edit form to set default value for these fields from the CopiedItem variable when you click "Copy" button.

 

Please take a try with above solution, then 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
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Do you want to copy an existing item within your custom form app, and make some changes to the copied item?

 

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

Add a "Copy" button within your Edit form (SharePointForm1) screen, set the Visible property to following:

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

set the OnSelect property of the "Copy" button to following:

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

 

Set the Item property of the SharePointForm1 to following:

If(
       IsBlank(SharePointIntegration.Selected.Executor.Claims) || IsEmpty(SharePointIntegration.Selected),
       First([@'Your SP List']),   // replace here with your actual SP List name
       SharePointIntegration.Selected
)

 

Set the OnSuccess property of SharePointForm1 to following:

Set(CopiedItem, Blank());   // Clear the CopiedItem variable
ResetForm(SharePointForm1);
RequestHide()

 

Set the Default property of the Text Input boxes within your SharePointForm1 to following:

If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.ColumnName1
)
If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.ColumnName2
)
If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.ColumnName3
)

....

same logic formula should be applied to all fields (Text fields, Choice fields, Date fields, ... etc) within your Edit form to set default value for these fields from the CopiedItem variable when you click "Copy" button.

 

Please take a try with above solution, then 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

Anonymous
Not applicable

@v-xida-msft i have an issue with the following code. In item property of the form, i can see an error in this code

Is Blank(SharePointIntegration.Selected.Executor.Claims)

shall i change the executor to created by column? 

Hi @Anonymous ,

It's my fault. The Executor is a Person type column in my SP List. On your side, you should type the following formula within the Item property of SharePointForm1:

If(
       IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),// Modify formula here
       First([@'Your SP List']),   // replace here with your actual SP List name
       SharePointIntegration.Selected
)

Just remain the default formula within the Item property of SharePointForm1.

 

Please 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.
Anonymous
Not applicable

@v-xida-msft thanks for the solution.  It works like a charm but then there are few columns which are not getting copied.
Like a People Picker or a Choice column. I am doing exactly the same thing. Any changes to be made?

Hi @Anonymous ,

Yeah, you are right. For Person field data card in your Edit form, please take a try with the following workaround:

Set the DefaultSelectedItems property of the People field ComboBox to following:

If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.PersonColumn
)

 

set the DefaultSelectedItems property of the Choice field ComboBox to following:

If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.ChoiceColumn
)

 

Please take a try with above solution, check if the issue is solved. If the issue is solved, please consider go ahead to click "Accept as Solution" to identify this thread has been 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.
Anonymous
Not applicable

@v-xida-msft i still cannot copy number column.
any idea why?

Hi @Anonymous ,

Could you please share a screenshot about the issue?

 

Please set the Default property of the Number field Text Input box to following:

If(
   SharePointForm1.Mode = FormMode.Edit,
   Parent.Default,
   !IsBlank(CopiedItem) && SharePointForm1.Mode = FormMode.New,
   CopiedItem.NumberField
)

 

Also please make sure the Number field has been populated with proper value within the parent record (current record is copied from).

 

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (64,171)