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.
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:
- In SharePoint 2013, create a SharePoint document library named MyDocs.
- Navigate to the MyDocs document library, and click Library > Settings > Library Settings.
- On the Settings page under Columns, click Create column, and create a Single line of text column named FirstName.
- Repeat the previous step to create a second column named LastName.
- On the Settings page under General Settings, click Advanced settings.
- On the Advanced Settings page under Document Template, click Edit Template. This should open Word.
- In Word 2013, modify the document to suit your needs by for example copying and pasting text from another document.
- 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.
- Repeat the previous step for the LastName document property.
- Click File > Save As > SharePoint > Browse.
- On the Save As dialog box, select Word Document (*.docx) from the Save as type drop-down list box, and then click Save.
- Close Word.
- 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:
- 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
- In SharePoint 2013, create a new SharePoint list named CreateDocsList and add two columns named FirstName and LastName to it.
- In SharePoint Designer 2013, open the site on which the MyDocs SharePoint document library and the CreateDocsList SharePoint list are located.
- 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.
- Add a Create List Item action to the workflow.
- Click this list in the sentence for the workflow action.
- 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.
- On the Value Assignment dialog box, click the second button behind the To this value text box.
- 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.
- On the Value Assignment dialog box, click OK.
- On the Create New List Item dialog box, click Add.
- 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.
- 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.
- On the Value Assignment dialog box, click OK.
- Repeat the previous 4 steps for the LastName field, and set the value to come from the LastName field of the Current Item.
- On the Create New List Item dialog box, click OK.
- 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.
- Adding a document template to a SharePoint document library using a content type
- SharePoint Designer workflow: Move a document from one library to another
- SharePoint workflow to move a document to a folder
- Create a content type for document routing to a Records Center
- SharePoint 2013 Document Center site