SharePoint Designer workflow: Create a new document based on a content type

Learn how you can use the default content type on a SharePoint document library to allow a workflow to automatically create new documents that are based on the document template of the default content type in the SharePoint document library.

ADVERTISEMENTS

Scenario

You want to use a SharePoint Designer workflow to create a Word, Excel, or any other type of document that is based on a document template that was added as a content type to a SharePoint document library.

Solution

You can use the Create List Item action in a SharePoint Designer workflow to create a new document that is based on a particular document template, but the content type for the document template must be set as the default document template on the SharePoint document library.

  1. In SharePoint, create a Custom List that has just one field (a Title) field. You will use this SharePoint list to enter the names of new documents, and then run the SharePoint Designer workflow to create these documents in a SharePoint document library.
  2. In SharePoint, add a document template as a content type to the document library you want to use to create documents, and make this content type the default content type for the document library.
  3. In SharePoint Designer 2007, open the SharePoint site on which the SharePoint list and document library you want to use to create documents are located.
  4. On the File menu, select New, and then Workflow.
  5. On the Define your new workflow screen of the Workflow Designer, enter a name for the workflow, select the SharePoint list you want to attach the workflow to (this would be the custom list you will use to enter the document names), select Automatically start this workflow when a new item is created, and click Next.
  6. On the Step 1 screen of the Workflow Designer, click Actions, and then click More Actions from the drop-down menu.
  7. On the Workflow Actions dialog box, select List Actions from the category drop-down list box, select Create List Item from the actions list, and click Add. The following text is added to the Workflow Designer:

    Create item in this list (Output to Variable: create)

  8. On the Step 1 screen of the Workflow Designer, click this list in the text of the Create List Item action.
  9. On the Create New List Item dialog box, select the document library in which you want to create a document from the List drop-down list box.
  10. On the Create New List Item dialog box, select the Name Field, and click Modify.
  11. On the Value Assignment dialog box, leave Name (for use in forms) selected in the Set this field drop-down list box, and click the formula button (the second button) behind the To this value text box.
  12. On the Define Workflow Lookup dialog box, select Current Item from the Source drop-down list box, select Title from the Field drop-down list box, and click OK.
  13. On the Value Assignment dialog box, click OK
  14. On the Create New List Item dialog box, click OK.
  15. On the Step 1 screen of the Workflow Designer, click Finish.

You should now be able to create a new item in the custom SharePoint list, specify the name for the new document as the Title for the list item, and once you save the SharePoint list item, the new document will be created in the SharePoint document library thereby using the document template you specified as the default content type on the SharePoint document library.

Tip

If you have to create documents that are based on several different content types, for example, both Word and Excel documents, or a New Project Word document template and an Incident Report Word document template, you can create several document libraries that have their default document templates set to each one of the document types you want to use to create documents, add Conditions to your SharePoint designer workflow to distinguish between creating the several types of documents, and once the documents have been created, use a second workflow on each document library to move the documents to the main document library that hosts the documents of all document types.

Related Articles

ADVERTISEMENTS