Reusable Workflow to Set Title
A SharePoint Workflows tutorial by Peter Kalmström In the previous article we explained why it is important that the Title fields in list and library items are filled out, and we showed how to create a list workflow that sets the title to the same as the item's name. That workflow only works for one library. If you want to set the title to the same as the name in another library, you have to re-create the workflow for that library.
Another option is to create a reusable workflow, also called a workflow template. In the demo below Peter Kalmström, CEO and Systems Designer of kalmstrom.com Business Solutions, shows how to create a reusable workflow that sets the title to the same as the name of the list item or file not only for one library but for all libraries in the site collection.
You have to create a SharePoint 2010 workflow, because SharePoint 2013 workflows cannot be connected to a specific content type, which is necessary for this workflow.
Create a reusable workflow that sets the title to the same as the name
- Open the root site of the site collection in SharePoint Designer 2013.
- Click on the Workflows link in the left panel.
- Click on the Reusable Workflow button in the ribbon.
- Create a new SharePoint 2010 workflow and give it a name. Connect the workflow to the Document content type.
- Select the Condition to 'If current item field equals value' and set it to Title 'not equals' Name.
- Select the Action 'Set Field in Current Item' and set the Field to Title and the Value to Name.
- Do not set any start options. Here you can only disable the workflow. Instead you will set the start options when you associate the workflow with the content type.
- Publish the workflow
Associate the workflow with the Document content type
Now all the site collection's existing and new libraries that use the Document content type (which is the default content type for libraries) will have this workflow.
- Open the Site settings in the root site of the site collection and click on the Site content types link in the Web Designer Galleries group.
- Select the Document Content Types and then click on the Document content type.
- Click on the Workflow settings link and then on Add a workflow.
- Select the reusable workflow you just created.
- Give the workflow a name and set it to start when an item is created or changed.
Run the workflow on existing files As the workflow is run at change or creation, existing files that are not touched will still be without a title. A quick way to make the workflow run on existing files is to create a dummy column and set a dummy value that changes the metadata of all files.
- Create a new column in the library.
- Modify the view to show the Title column and the new column.
- Open the library in Quick Edit mode and set a value in the first cell in the new column.
- Drag the value down to all documents. (If you have many documents in the library, you should open it in Access and work with it there instead.)
- When the workflow has run and all the titles are there, remove the dummy column again.