Site icon @WonderLaura

Copy List Item to New – Another Method

Back in 2011, I wrote a post Click to Copy List Item to New.  I’ve had several requests for a re-write of this for 2013.  Actually, this method I’m going to show you can be done in 2010, 2013 and Office 365.

In this concept, I’ll show you how to create a workflow that simply creates a new item and pre-populates the columns with values from the current item.  In this example, I’ll be using a list called “New Hires” (which is using the contact list template).  If someone has entered a new hire into the list, and wants to quickly add another one that’s mostly the same, in this case the first and last name fields would be the only difference.  Here are the steps:

  1. In your new workflow (I’m naming mine Copy New Hire), click the button in the ribbon called Initiation Form Parameters.
    The reason we’re doing this part, is so that when they click to copy a new hire, they will be presented with a form to fill out the first and last name of the next new hire.
  2. Click the Add… button, and the first Field Name will be called First Name.  Keep the default information type as a single line of text.  Click Next.
  3. Leave the default value blank, and click Finish.
  4. Repeat step 2, creating a second field called Last Name the same way.
  5. On the Association and Initiation Form Parameters screen, click OK.
  6. Add an action to your workflow, called Create List Item.  Click the blue words this list.
  7. For the List drop-down box, I’m choosing my New Hires list, so I’m really just creating a new item in the same list that I’m running the workflow in.
  8. Any required fields in your list will automatically show here with asterisks next to them.  Also, if you’re using multiple content types in your list, the Content Type ID field will show.  Click to select the Last Name field, and click the Modify button.
  9. Where it says To this value, click the fx (function) button.  For the data source, choose Workflow variables and Parameters.  For the Field from source, choose Parameter: Last Name.  Click OK. (twice)
  10. The idea is that although we’re going to copy this item to be a new one, there are usually going to be one or two fields that are going to be different.  Those are the ones that we create as parameters to pass to the new item.  In this case, it’s just first and last name, so all of the other fields will end up getting set up with the same value as the item we’re copying.  In this case, the last name was the only required field, so it was the only one showing on the Create new List Item screen.  I still have to add a bunch of other fields here.  Click the Add button.  For Set this field, choose First Name.  For To this value, repeat what you did in step 9 for the last name, except this time you’re using the parameter called First Name.  Click OK.
  11. Now that the two parameters have been added (you may have more in your own solution, however many you need), it’s time to add all the rest of the fields.  Click the Add… button.  City is going to be my next one, so for Set this field, I choose City.
  12. Click the fx (function) button next to To this value.  The Data source should be Current Item, and for the Field from source, I choose City also.  Click OK. Click OK.
  13. My next field is going to be Company.  Repeat steps 11 and 12, but instead of choosing City in both places (in purple), I choose Company.
  14. Repeat steps 11 and 12 for all of the other fields in your list that you want to be pre-populated when the new item (copy) gets created.  Notice in this screenshot that the first and last name fields are from parameters, and all the others are just going to be a copy of what is in the current item.
  15. When you’ve finished adding your fields, click OK.  If you are using a SharePoint 2013 workflow, you’ll need to add a Go To action in your Transition to stage, but then the workflow is ready to publish! (I also gave my stage a pretty name other than Stage 1)
  16. In your New Hires list in SharePoint, go to the List tab in the ribbon and click the button New Quick Step.  Alternately, you can open SharePoint Designer, go to Lists and Libraries, and click the name of your list there.  The Custom Actions are the exact same thing as Quick Steps.
  17. Instead of using the generic screen for creating a new custom action, called Create Custom Action, click cancel.  Put your cursor in the section at the bottom called Custom Actions.  Once you do that, you’ll see Custom Actions in the ribbon, with the drop-down box for a new Custom Action.  Here’s where it is when you’re on that list’s settings page in SPD:
  18. Click the Custom Action drop-down box in the ribbon.  Choose List Item menu.  Keep in mind that you can create many different types of custom actions that all do the same thing, these custom buttons will just show up in different places such as the list item menu, the Display Form ribbon, etc.
  19. Name your custom action Copy to New.  Or you can call it whatever you want, really.  Type a description, so that people will know what this button does.  In the section called Select the type of action, choose Initiate workflow.  Choose the workflow you just published, mine is called Copy New Hire.  Click OK.
    Extra notes: Keep in mind that if you have images that are 16×16 or 32×32, stored in SharePoint, you can fill in the button image URL field as well.  Also, in this workflow’s Start Options, I have it so that it can be manually triggered.  If your workflow is not allowed to be manually triggered, it will not show up in the list of workflows to select from when choosing Initiate workflow as the action for your custom action.
    Click OK.
  20. Now, when I go to my New Hires list in the browser, and I click the ellipsis or drop down box on an item in the list, “Copy to New” is now an option in that drop-down.  I click it, fill out the parameters, and then as soon as I click Start, the new item gets created.

That’s a pretty simple solution, but there are a couple of issues.  The initiation parameters don’t allow us to do required fields, so it will allow people to kick off the workflow without actually filling in the parameters.  If a fields is required, it would then have the words “No Title” in it, instead of any actual first or last names.

Another issue, is that after the workflow runs, it bounces the user back to the homepage of the site.  So although the item does get created, they don’t immediately see it.  One super simple solution to this would be to put a list web part on the homepage called “My New Hires” and make it have a filter of “Created By” is equal to [Me] and for it to be sorted by the Created date descending.  That way, even though they get bounced back to the homepage, they’ll immediately see the item they just created.

Here’s some more info about custom actions / quick steps:

Exit mobile version