0

I have records in my database and when viewing a record, I wanted to be able to have a button that would create a new record (new ID number) with the same data that was in the record I chose to create a new one off of. So a user wouldn't have to re-type all of the data in if they would like to change one thing.

So essentially I want to be able to clone a item into a new record.

Any help would be appreciated

  • Which version of SharePoint you are using? – Amal Hashim Jan 21 '15 at 19:38
  • SharePoint 2013 – Matt Ludwig Jan 21 '15 at 19:40
2

You can do this with a little bit of custom code.

The ideal solution will be either to place a custom action in the Item Context Menu or in the Ribbon. Then clicking that will do the copy of the current selected item and opens up the edit form of the newly created item.

http://sharepointx-men.com/2013/03/13/part-ii-create-new-list-item-by-copy-existing-list-item-and-then-edit-the-newly-created-list-item/

If you don't want this method, then you can use JSOM to get the currently selected item. Then from client side you can create a new item and open up the edit form using SP.UI.Dialog or simply redirecting user to that page.

  • How do I use jsom for the second method Iv never tried it – Matt Ludwig Jan 21 '15 at 19:56
  • Add a script editor webpart to the page. Then use this to find out the current selected item. Then use this to create a new item – Amal Hashim Jan 21 '15 at 20:00
  • <CommandUIHandler CommandAction="javascript:viewDialog({ItemId});"/> function viewDialog(id) { var options = { url: "/sitename/Lists/ListName/ViewName.aspx?ID=" + id, width: 800, height: 600, }; SP.UI.ModalDialog.showModalDialog(options); } – Matt Ludwig Jan 21 '15 at 20:15
  • that goes in the script editor snippet? – Matt Ludwig Jan 21 '15 at 20:15
  • Yes. Please read the answer and copy only relevant portion. – Amal Hashim Jan 21 '15 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.