Skip Ribbon Commands
Skip to main content

Laura Rogers @WonderLaura

:

Quick Launch

Laura Rogers @WonderLaura > Posts > Click to Copy List Item to New
Hi everyone,
My blog now has a new URL!
You can now find me at http://www.wonderlaura.com
March 04
Click to Copy List Item to New

Often times, you have a SharePoint list item with all of the fields filled in, and want to simply copy that item to create a new one.  One way to go about it would be to put all of the columns in a datasheet view, and copy an entire row to another one, but that’s not always the most feasible solution.  In this post, I’ll show you another method, how to create a button on a list item which will “copy to new” and then automatically bring up the new item to edit.  This can be done in both SharePoint 2007 and 2010, but my example will be 2010.

Main components to make this work:

  • A SharePoint Designer workflow to copy the list item
  • A custom data view web part for a new list item
  • A custom button that runs the workflow and navigates you to the DVWP.
  1. Create a SharePoint Designer Workflow which can be manually started.  There will be one action: Create List Item
    ch5[137]
  2. Pick the same name as the current list.  You may want one of the fields to be unique when they create a new request, so you can leave it out of this list of fields.  Add all the different fields on this screen using the Add button, giving them each the same value as the current list item.
    ch5[138]
  3. Publish the workflow. (I’m naming my workflow “Copy Request” because I’m copying a help desk request.
  4. In SharePoint Designer, click Lists and Libraries on the left, and click the name of the list.  In this case, it’s Request Log.
  5. In the Forms section on the right, click NEW.  Fill the screen in as so, and click OK.
    ch5[139]
  6. Now, in the forms section, click the name of CustomEdit.aspx to open it.
  7. Hide the existing form web part that’s on the page, we’re not going to use it.  In the web part tab in the ribbon go to properties, then in layout choose Hidden.
  8. At the bottom of the page, click in the spot (at the very bottom of the other web part), to insert a new one.  Click the Insert tab in the ribbon, click the Data View drop-down, and choose Empty Data View.
  9. Click in the middle of this new web part to select a data source, and choose that same list you’re in, in this case, the Request Log.
  10. Use the CTRL key to select multiple fields that you’ll want in the form to be filled out, and click Insert Selected Fields As… and choose Single Item Form.
    ch5[140]
  11. Filter the data view web part by Created By is equal to [Current User]
  12. Sort the data view web part by Created (descending).  Because of our filter and sort, when users go to this page, it will automatically show them the last item that they just created, in edit mode.
  13. After users have created this duplicate item and clicked SAVE, where do you want them to be directed to?  By default, the Save button will save but not take you away from the page.  Right-click the Save button on this custom form, and choose Form Actions.
  14. After Commit, add Navigate to Page.  Click Settings on the right, and pick which page you want them to be directed to after saving.  After this, I usually have to go into the code and fix the hyperlink because it doesn’t work.  Just start with making it absolute and it’ll work like a charm.
    ch5[145]
  15. Now, we just need a button that, when clicked will run the workflow to copy the item and then take us to this page.
  16. Go back to the list you’re working on, click the drop-down box on any of the existing items in the list, and click Workflows.
  17. Right-click on the name of the workflow that you just created, and Copy Hyperlink.  This is the link to run the workflow, so paste it into Notepad so we can tweak it.  After the &Source, clear that out and paste in the URL of the CustomEdit.aspx form that you just created. Here’s an example:

    http://site/_layouts/IniWrkflIP.aspx?List={39dd263a-7b94-4d9b-86b7-a17b64498f9c}&ID=9&TemplateID={69c96028-e504-4317-8e2f-fd319c4cf669}&Source=/site/Lists/RequestLog/CustomEdit.aspx
  18. See the ID=9 that I highlighted in red?  That’s the ID of the item that you’re copying, which will need to vary according to which list item we’re copying.
  19. Back in SharePoint Designer in your list, click on the right side of the screen, putting your cursor INSIDE the Custom Actions section.
    ch5[142]

  20. Don’t click the New button here in the Custom Actions section, but look up in the ribbon and click the Custom Action drop-down box.  This lets you pick where you want the button to be, such as on the display form or list item menu.
    ch5[143]

  21. Call the custom action “Copy This”, and use the Navigate to URL option, and paste your customized URL you created at step 15.  In the ID= part, though, you have to replace the actual ID number with {ItemId}, and click OK.
    ch5[144]

Done.  Now click on an existing item in your list, and click on the “Copy This” button that you just created.  Click Start, and you’ll be taken to the Edit page of the item that you just created as a copy of the other item.  Make any needed changes and click Save.  Done.

This solution works in SharePoint 2007 and WSS 3.0 in addition to 2010.  Just in 2007 you don’t have the easy Custom Action button and you’d have to manually create the hyperlink instead, such as in a data view web part.

 

Comments

@SusanINFJ

Very clever!  :)
Shane YoungNo presence information on 3/4/2011 2:57 AM

eric

Perfect as always Laura.  I've done somethign similar for a purchasing site here and this is much more elegant.  I'll keep it dog-eared.
Shane YoungNo presence information on 3/4/2011 7:24 AM

JoeH

Fascinating - I had no idea it was possible to run a workflow from a URL! Very useful.
Shane YoungNo presence information on 3/4/2011 7:56 AM

Ray Ranson

Great post!
Shane YoungNo presence information on 3/4/2011 8:30 AM

Manu

Hi Laura! Great post as usual. I've found your posts in the former EnduserSharepoint.com site very useful. You said this also works for SP 2007, would it be possible for you to show it? Thanks and more power!
Shane YoungNo presence information on 3/4/2011 2:11 PM

Bhavesh

Awesome post Laura !! I've used similar kind of workflow button before for Register/Unregister events in a calendar before. This is another clever use of custom form actions.
Shane YoungNo presence information on 3/8/2011 4:38 PM

Laura

Manu, Here's the vid on how to customize a list form in 2007: http://www.endusersharepoint.com/2009/09/11/customize-form-pages-in-sharepoint-screencast/  Then, at the end, instead of being able to create a custom action, you'll just have to form a hyperlink in the list item or something else.  You can do this by creating a hyperlink field in the list, and then in a workflow have it set the value of the hyperlink when an item is created.
Laura RogersNo presence information on 3/17/2011 11:07 PM

ngelay

Please show me how to do this in SPD 2007 :( ... I want to copy list items to another site location list. But can't get it. I need to copy all items list to another site collection when the use enter new data and click on ok in the newform.aspx. Thank you.
Shane YoungNo presence information on 3/23/2011 12:43 AM

prabir

Hey Laura, Thanks for this post. This is neat and helpful. I tried this and it works like a charm.  BUT when i use this to copy a list item containing a spreadsheet, the spreadsheet created for the new item does not open. And the file size is less than the original one. Seems the file gets corrupted during the process.  Any help on this. Thank you.
Shane YoungNo presence information on 4/6/2011 2:33 AM

Laura

ngelay, Sorry I wouldn't know how to do this copying to another site collection.    prabir, This solution is just for a regular list item, and not a file or item attachment.  I haven't tried it that way.
Laura RogersNo presence information on 4/21/2011 8:58 PM

Chris

Hi Laura,  Can you please guide me for this solution on SP2007?  "you'll just have to form a hyperlink in the list item or something else.  You can do this by creating a hyperlink field in the list, and then in a workflow have it set the value of the hyperlink when an item is created."  I have been trying create the hyperlink to run the Workflow and point back to the EditForm page with a new ID, but I cannot figure this out.  Can you please walk me through this?  Thanks!
Shane YoungNo presence information on 5/2/2011 3:03 PM

Elena

I built a workflow in SP2007 to create a new copy of a list item with a modified title if the field MakeCopy had been checked to yes.   Needless to say it would also update the existing item to uncheck that box, and the title was modified to Blahblahblah - Copy and two or three other fields were updated as appropriate.   The logjam there, which still exists for me in 2010, was that the copy list item workflow action won't let me specify a folder to land in.  Would anyone have any ideas on how to designate an arrival folder for a list item?  For library documents it is possible, but for lists I struck out.   I am using folders in the list to apply permissions, one folder per sales region.  Thank you! Elena
Shane YoungNo presence information on 7/12/2011 6:41 PM

Rahul Vartak

If you are using SharePoint 2010, another approach is to create a custom ribbon button and write ECMA Script to clone the items.   Benefits: 1.  You don't need to create / update an item and then write the cloning functionality in its event handlers. 2. Permissions can be handled so that only eligible users see the button. 3. Asynchronous calls 4. The button can be limited to a single list or be applied to a list template   Find more details here.  http://rahul-vartak.blogspot.com/2011/07/clone-sharepoint-list-items.html
Shane YoungNo presence information on 7/19/2011 3:22 AM

Laura

Elena, You can't use the copy action to do what you're trying to do, but you can use the "create new item" action instead.  When you create new item, it lets you specify what folder to put it in, you just have to go in and specify every single value of every single field also.  Rahul, I'm not a developer, but I'm sure that if a real dev happens to stumble upon my blog and reads your comment, it may be helpful.  I have no idea what you're talking about.  ;-)
Laura RogersNo presence information on 7/22/2011 9:13 PM

Jessica

Brilliant tutorial so far, but im using SPD 2007, so could you please expand the steps after step 15, about how to create the button, as on 2007, there is no Custom Action Creation window  Thanks in advance
Shane YoungNo presence information on 9/1/2011 10:22 AM

Laura

Jessica, Unfortunately, I don't have time to write more instructions as to how to do it in 2007, as I'm currently writing a book.  You'd have to create a data view web part, add a column to it, and then create a hyperlink in that new column, which would be formulated in the same syntax as in the custom action I described.
Laura RogersNo presence information on 9/3/2011 8:58 PM

Vincent

Hey Laura, great post! love it .. just what I needed .. I only have 1 issue  He doesn't show the customedit.aspx page when I run Copy This” workflow on the list item, he copies the item OK, but show the list not the form, any ideas? I'm sure the link after the &Source is correct.. really bizar  thanks for your help :-)
Shane YoungNo presence information on 9/15/2011 11:04 AM

Laura

Vincent, At step 17, you put the link to the customedit.aspx form you created, but when you go to the link, it doesn't take you to the page in the link?  Remember that each time you change and re-publish the workflow, you'll need to get the new URL for the workflow because it changes each time a new version of the workflow is published.
Laura RogersNo presence information on 9/21/2011 9:53 PM

Vincent

Hey Laura,  Thx for your reply! I can go to the page just fine, entering it in the URL field of the browser: http://site/Lists/listname/customedit.aspx The workflow runs, it creates a new item in the list, but after creating it, it doesn't open the customedit.aspx page, it just takes me back to the initial list view, it seems like it doesn't matter what I use after &source=  it just takes me back to the list, doesn't open the form  On the custom action page I'm sure that the navigate to URL is correct with the URL of the latest published workflow http://site/_layouts/IniWrkflIP.aspx?List={39dd263a-7b94-4d9b-86b7-a17b64498f9c}&ID={ItemId}&TemplateID={69c96028-e504-4317-8e2f-fd319c4cf669}&Source=/site/Lists/RequestLog/CustomEdit.aspx  i've tried every possible combination after &source= /site/Lists/listname/CustomEdit.aspx http://site/list/listname/customedit.aspx http%3A%2F%2Fsite%2FBD%2Fsitename%2FLists%2Flistname%2FAcustomedit%2Easpx  even tried some other forms just to make sure that it wasn't the problem of that form, but nothing seems to work, it just takes me back to the original list seems like it ignores what happen after &source= however when I remove the &source completely it fires up and workflow error when I start it Redid your instructions serveral times, just to make sure..   really bizar .. and really need this to work actually :s  many thx for your help !!  Kind Regards, Vincent
Shane YoungNo presence information on 9/22/2011 2:26 AM

Gomathy

Hi Laura,  I have list item with nested data view web part. Now I need to copy the item with nested web part. Is it possible to copy the web part content also?  Please suggest me  Thanks, Gomathy
Shane YoungNo presence information on 9/29/2011 8:21 AM

Britta

Hi Laura, thank you alot for this tutorial. I wolud like to use it with a SP 2010 list wit a customized New/Edit form (infopath), now a have an editifs.aspx. If i use this link I get an "unexpected error". Could you help  Kinds regards britta
Shane YoungNo presence information on 10/5/2011 6:47 AM

Laura

Vincent, Hi, I've never seen &source just not work.  Sorry, I don't know.  Gomathy, No, I wouldn't know how to do that.  Britta, This doesn't apply to InfoPath forms.  This solution only uses a data view web part.
Laura RogersNo presence information on 10/11/2011 10:56 AM

Connie

Wonderful post,  All works as expected except the CustomEdit form.  After starting the workflow, I get to the start page, press start, my CustomEdit form appears, I use drop downs to enter the information and click save.  I am then directed to the page I designated.  However the copy of the list item is not populated with the changes or addtitons from the CustomEdit form to the list after save?
Shane YoungNo presence information on 10/19/2011 9:26 AM

Laura

Connie, That's weird, I've never seen that happen.  To test, try filling out the custom edit form just without the workflow or any of that, and see if maybe the save button isn't working at all? You can right clilck on the button and choose "form button actions" (or something like that) and it will let you see what the button does when pressed.
Laura RogersNo presence information on 10/20/2011 9:41 PM

G S Praveen

Hello Laura,  I tried using "copy item" but the problem what I'm facing is, let's assume I've 3 lists called List A, List B and List C.  In which, List A has several columns say, Region (LA/NA), SKU #, SKU Description, Workflow, Initial Date and End Date.   Now, I want to to validate, if the Region says LA the first three columns (SKU#, SKU Des.... and Workflow) should copy in List B and if regions says NA the same columns should get update in List C.    I tired using "if" condition and "copy item" action, I am able to bring only SKU # not the other 2 columns.  Also, when I edit it's getting duplicate.  I am stuck here Laura - Please help me  were I'm going wrong!!  Thank you.
Shane YoungNo presence information on 11/10/2011 6:42 AM

Laura

Praveen, That's way complicated.  I'd have to have more information or a screenshot of your workflow or something.
Laura RogersNo presence information on 11/11/2011 8:30 PM

Jewell

Hi Laura,  Great post, but i'm having the same issue as Vincent.  I have looked over my url and everything is correct but when I start the workflow it copies but doesn't open my customedit.aspx page.  Any suggestions?  Here is the url that I am entering into the custom action. http://site/_layouts/IniWrkflIP.aspx?List={ebe6fc71-9d7c-496a-9215-e4d9a32db01c}&ID={ItemId}&TemplateID={5878908e-02f2-402a-af4c-950c55c52922}&Source=http://site/testdev/Lists/Test%20Migration%20Request/CustomEdit.aspx
Shane YoungNo presence information on 11/14/2011 12:53 PM

Laura

Jewell, You're putting your own site where it says "http://site", right?
Laura RogersNo presence information on 11/23/2011 8:48 PM

KC

Laura,  My requirement is to be able to copy calendar events from one calendar to another, via a button or checkbox, as creation or edit.  They are in the same site collection, but in different subsites.  It seems this solution should work, except:  Do I need to paste in the ID URL for every ITEM?  Not for the LIST?  If the item hasn't been created yet, and there may be hundreds, this will not work.  Am I reading this correctly?
Shane YoungNo presence information on 11/28/2011 3:18 PM

Laura

KC, A SharePoint designer workflow will not let you copy from one subsite to another.  Can you guys just connect the calendars to Outlook, and drag stuff from calendar to calendar to copy them?
Laura RogersNo presence information on 11/30/2011 9:24 AM

Sijo John

Hi Laura,  The custom button (copy) runs the workflow but not navigating to the DVWP.  My list is in a sub-site. Is it an issue?   http://SiteName/sites/home/subsite/_layouts/IniWrkflIP.aspx?List={f4f00dcf-63aa-4572-b2c4-4c289895d111}&ID={ItemId}&TemplateID={7e6c2a68-ffbb-4617-9502-284b66cc1c2b}&Source=/sites/Lists/TestReview/CustomEdit.aspx
Shane YoungNo presence information on 12/6/2011 4:30 AM

John

Hi Laura,  The workflow works just fine and new item created. But am not navigated to the 'customedit' form.  My list is in a subsite. Can you please give little more details on the url?  BR, John
Shane YoungNo presence information on 12/7/2011 12:02 AM

Laura

John, A sharepoint designer workflow will not let you copy an item to another site, so this solution won't work for you if that's the case.
Laura RogersNo presence information on 12/16/2011 11:02 AM

Akash

Laura,
I want to use a infopath instead of regular sharepoint form.
How can I do the same?

I actually tried it and it works as well but only thing is when I start workflow a blank form is opened like new item form and when I close it the item gets saved.

Can you pls help me in this.
 on 2/17/2012 8:03 AM

Laura

Akash,
To do this in InfoPath would require a completely different method.  I'll have to write a new blog post about this when I get a chance.
lauraNo presence information on 2/24/2012 10:54 AM

KC

Read through your article and found it intriguing. Then I read through the comments. I have an off subject question. I have been given the task of launching SharePoint 2010 for a large corporation. I didn't even know what SharePoint was 4 months ago. What cram course would you recommend for a true novice that really needs knowledge? I am interested in workflows, libraries, lists, etc. but I don't even know where to start.
 on 4/25/2012 8:19 AM

Brent

Laura,
I'm getting stuck on the Navigate to URL section.  I'm running Foundations and when I put https://site/_layouts/IniWrkflIP.aspx....into the Custom Action section and then run the "Copy This" link, I get a log error saying '/_layouts/IniWrkflIP.aspx' does not exist.....Does this not work in Sharepoint Foundations?
 on 6/7/2012 5:46 PM

Laura

KC,
You can read my book: Beginning SharePoint 2010 Builiding Business solutions with SharePoint.

Brent,
I recommend trying it as an absolute (full) URL instead of relative.
lauraNo presence information on 6/13/2012 10:55 PM

Jaime Bell

Can you perform this function in an entirely separate list?  How would you amend the above instructions to do so?
 on 6/14/2012 5:53 PM

Laura

Jaime,
Sure, at step 1, just pick a different list from the drop-down box.  Then, that customedit form needs to be created in that other list.
lauraNo presence information on 6/27/2012 10:02 PM
​I have disabled any new comments on this, because my blog has moved to a new site.  Please go here: http://www.wonderlaura.com
RSS FeedFacebookYouTube
 

 Our Books for End Users