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

Copy Button to New Entry on Sharepoint List

Hello Guys,

Just need to seek some help. 
I've create an app in which I add a copy and edit button inside my gallery, and I want to know if is possible to do the copy on powerapps in which If I clicked the copy button it will get the data I selected on the gallery. I changed the FormMode to Edit to get the data of the item I selected on the gallery and what I want is that If I submit that Form it will create a new entry on Sharepoint List.

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Copy Button to New Entry on Sharepoint List

Ok @Marlin-A ,

Reading your original post you describe a button in a gallery that when clicked on gets a copy of the item selected in the gallery. The collection code will do that. Then you want to submit this to a new entry in SharePoint - the Patch will do this.

You have supplied a screenshot of the item in an edit form - the principle is the same as the collection contains exactly the same content as the edit form.

If it makes more sense to you, Patch the content of the edit form as a new record, except you would have to refer to the control names - so using your labels in the screenshot and guessing the dropdowns are Choice Fields - don't worry about the Collection and to this from your New button

Patch(
   DataSource,
   Defaults(DataSource)
   {
      'Member Email':DateCardValuexx.Text
      'Member Name':DateCardValuexx.Text
      'Task Type':DateCardValuexx.Text
      Client:DateCardValuexx.Text
      Duration:DateCardValuexx.Selected.Value
      'Project/Case Status':DateCardValuexx.Selected.Value
      'Project/Case':DateCardValuexx.Text
      'Project/Case Description':DateCardValuexx.Text
   }
)

 - you will have to correct any field names and put property xx numbers in your control names.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up

View solution in original post

11 REPLIES 11
Highlighted
Community Champion
Community Champion

Re: Copy Button to New Entry on Sharepoint List

Hi @Marlin-A ,

You can do a collection (call it whatever you want) with the Gallery item on the OnSelect

ClearCollect(
   colMyRecord,
   ThisItem.Selected
)

 You could then use Patch to put it back

Patch(
   DataSource,
   Defaults(DataSource)
   {
      FieldName1:colMyRecord.FiendName1
      FieldName2:colMyRecord.FiendName2
      FieldName1:colMyRecord.FiendName1   //and so on for the rest
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Helper IV
Helper IV

Re: Copy Button to New Entry on Sharepoint List

Hello again sir @WarrenBelz ,

 

Sorry, I don't get your point. 

but here my screenshot I already got the data when I clicked on my gallery
1.jpg

What I need now is that when I submit this It will create a new entry on sharepoint list rather than editing it.

 

Thank you!

Highlighted
Community Champion
Community Champion

Re: Copy Button to New Entry on Sharepoint List

Ok @Marlin-A ,

Reading your original post you describe a button in a gallery that when clicked on gets a copy of the item selected in the gallery. The collection code will do that. Then you want to submit this to a new entry in SharePoint - the Patch will do this.

You have supplied a screenshot of the item in an edit form - the principle is the same as the collection contains exactly the same content as the edit form.

If it makes more sense to you, Patch the content of the edit form as a new record, except you would have to refer to the control names - so using your labels in the screenshot and guessing the dropdowns are Choice Fields - don't worry about the Collection and to this from your New button

Patch(
   DataSource,
   Defaults(DataSource)
   {
      'Member Email':DateCardValuexx.Text
      'Member Name':DateCardValuexx.Text
      'Task Type':DateCardValuexx.Text
      Client:DateCardValuexx.Text
      Duration:DateCardValuexx.Selected.Value
      'Project/Case Status':DateCardValuexx.Selected.Value
      'Project/Case':DateCardValuexx.Text
      'Project/Case Description':DateCardValuexx.Text
   }
)

 - you will have to correct any field names and put property xx numbers in your control names.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up

View solution in original post

Highlighted
Helper IV
Helper IV

Re: Copy Button to New Entry on Sharepoint List

Hello @WarrenBelz ,

 

I got a problem on my combobox that gives me "Does not match the expected type 'Record'. Found type 'Text'".

also I tried to remove all my combobox on my patch to test if it will create a new record but it shows that the Entry was just edited and not creating a new entry.

 

Thank you!

Highlighted
Community Champion
Community Champion

Re: Copy Button to New Entry on Sharepoint List

OK @Marlin-A ,

It seems your first question is answered - now we are debugging code.

I cannot see your data - which ComboBox is giving the error?

 

Highlighted
Helper IV
Helper IV

Re: Copy Button to New Entry on Sharepoint List

Hello Sir @WarrenBelz ,

 

It looks good now on creating a new entry, just got a little problem in here1.PNG

Duration column is a choice.

 

Thank you!

Highlighted
Community Champion
Community Champion

Re: Copy Button to New Entry on Sharepoint List

 Ok @Marlin-A ,

Yes - but is it probably numeric in the data source - try

Duration:Value(DateCardValue6_2.Selected.Value)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Helper IV
Helper IV

Re: Copy Button to New Entry on Sharepoint List

Hello @WarrenBelz ,


Yes sir, It is a numeric in the datasource. 
and I tried that before and it gives me a default value and this error.

1.PNG

 

Thank you!

Highlighted
Community Champion
Community Champion

Re: Copy Button to New Entry on Sharepoint List

OK @Marlin-A ,

It seems it is a Choice field - so back to text again, but with a difference.

Try this - I cannot test the result as I cannot see your data.

Patch(
   'WFH-Reporting‘,
   Defaults('WFH-Reporting'),
   {   
      'Member Email':DataCardValuel_2.Text,
      'Member Name':DataCardValue2_2.Text,
      'Task Type':DataCardValue16_1.Text,
      Duration:
      {
         '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
          ID: 1,
          Value: DataCard6_2.Selected.Value
      }
   }
); 
Navigate(
   SuccessScreen,
   ScreenTransition.Fade
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up

Helpful resources

Announcements
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

Super Users Coming in August

We are excited for the next Super User season.

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,312)