SharePoint workflow to create a document from a list item

Learn how you can use a SharePoint Designer workflow to create a document in a SharePoint document library based on data that is stored in a SharePoint list item.

ADVERTISEMENTS

If you want to use the data that is entered into fields of a SharePoint list item to create a Word document, you can use a SharePoint Designer workflow to do so.

The basic idea is to use the document template of either the default content type of a SharePoint document library or a content type that you have added to a SharePoint document library and that has a Word document set as its document template.

Once you have configured a content type and document template for a SharePoint document library, all you then have to do is create a SharePoint Designer workflow that makes use of a Create List Item action to create a document based on data that has been entered for the SharePoint list item the workflow is running on.

Configure a Word document template for a SharePoint document library

Before you can use a SharePoint Designer workflow to create a document, you must either add a document template as a content type to a document library or configure the default content type of the document library as follows:

  1. In SharePoint 2013, create a SharePoint document library named MyDocs.
  2. Navigate to the MyDocs document library, and click Library > Settings > Library Settings.
  3. On the Settings page under Columns, click Create column, and create a Single line of text column named FirstName.
  4. Repeat the previous step to create a second column named LastName.
  5. On the Settings page under General Settings, click Advanced settings.
  6. On the Advanced Settings page under Document Template, click Edit Template. This should open Word.
  7. In Word 2013, modify the document to suit your needs by for example copying and pasting text from another document.
  8. Place the cursor where you would like the first name to appear and then click Insert > Text > Quick Parts, and then select Document Property > FirstName from the drop-down menu that appears.
  9. Repeat the previous step for the LastName document property.
  10. Click File > Save As > SharePoint > Browse.
  11. On the Save As dialog box, select Word Document (*.docx) from the Save as type drop-down list box, and then click Save.
  12. Close Word.
  13. In SharePoint 2013, on the Advanced Settings page under Document Template in the Template URL text box, change the dotx file extension to docx. So the resulting Template URL would be:

    MyDocs/Forms/template.docx
  14. Click OK.

The SharePoint document library is now ready to be used by a SharePoint Designer workflow to create documents.

Create a SharePoint workflow to create a document from a list item

  1. In SharePoint 2013, create a new SharePoint list named CreateDocsList and add two columns named FirstName and LastName to it.
  2. In SharePoint Designer 2013, open the site on which the MyDocs SharePoint document library and the CreateDocsList SharePoint list are located.
  3. Create a new SharePoint list workflow and associate it with the CreateDocsList SharePoint list. Ensure that you select SharePoint 2010 Workflow as the Platform type.
  4. Add a Create List Item action to the workflow.
  5. Click this list in the sentence for the workflow action.
  6. On the Create New List Item dialog box, select MyDocs from the drop-down list box, select Path and Name (*) in the fields list, and click Modify.
  7. On the Value Assignment dialog box, click the second button behind the To this value text box.
  8. On the Lookup for String dialog box, leave Current Item selected, select ID from the Field from source drop-down list box, and click OK.
  9. On the Value Assignment dialog box, click OK.
  10. On the Create New List Item dialog box, click Add.
  11. On the Value Assignment dialog box, select FirstName from the drop-down list box, and then click the second button behind the To this value text box.
  12. On the Lookup for Single line of text dialog box, leave Current Item selected, select FirstName from the Field from source drop-down list box, and click OK.
  13. On the Value Assignment dialog box, click OK.
  14. Repeat the previous 4 steps for the LastName field, and set the value to come from the LastName field of the Current Item.
  15. On the Create New List Item dialog box, click OK.
  16. Configure the workflow to start automatically when an item is created and then publish it to SharePoint.

In SharePoint 2013, navigate to the CreateDocsList SharePoint list and add a new item to it. Fill out the fields and save the item back to the SharePoint list. Once the workflow has run and completed, navigate to the MyDocs SharePoint document library and verify that a new document was created. Click on the name of the document to open it in Word and verify that the data you entered for the SharePoint list item appears in the newly created Word document.

Related Articles

ADVERTISEMENTS