In the context of SP Online or SP 2013, we visualize them to be omnipotent, or if not for this, then atleast have much more vigour than their predecessors. What also bestows to the pool of features is also the availability of the SharePoint Designer (SPD) 2013 workflow. However, a little use of workflows using SPD 2010 also can extend the OOTB capabilities.
Workflows need not just be visualized as a process to flow items or streamlines tasks among users, rather in the simplest form, a workflow can also update data in field.
This article sheds lights on exploiting the capability of SP Online in conjunction with a SPD 2010 workflow to dynamically create documents in a document library.
A SharePoint document library not only acts as a repository for documents, but it can also be used to dynamically generate documents as mentioned before. The process requires coupling the document library with a custom list with the same field definitions as the document library using a workflow and editing the document template to format it using Quick Parts to place fields of the document library.
Though the process is worthwhile to generate documented format of a list containing simple text, there are still some limitations to this way of creation, in the use of embedding pictures or styling text.
The following section details the entire process.
Creating a Custom List for feed
The process is verified to work well only with data of single or multiline text (selected as Plain Text).
For the purpose of demonstration, a simple document library is created with columns of type single and multiline text.
N.B.: In the document library, the Title column of the document library is renamed Member Name.
To feed to this document library, a list is created, with columns mapped to that of the document library.
N.B.: In this list, the Title column of the document library is renamed Member Name.
As mentioned earlier, the only restriction with using multiline text is the use of Plain Text as illustrated below.
Customizing the Document Library
In the document library, go to Settings –> Advanced Settings and in the Document Template section, Edit Template.
The template is opened in the default word application. To format the document to use data from the columns of the document library, position the cursor in the document and from the menu, go to Insert –> Quick Parts –> Document Property and select the column.
Having formatted this template to place data as desired, save the template in the same location of the document library, but in docx format.
Upon exiting from the word application, modify the extension of the document template in the document library to point to the modified template (docx instead of
The document template is now ready to display details corresponding to each row of the document library as data gets filled in.
The last task now remains to populate the document library.
Dynamically populating the Document Library
Having already created the custom list with columns mapped to that of the document library, create a workflow for the list, to copy list data to the document library. A single action SPD SP 2010 workflow suffices, by triggering it when items are created or modified in the list.
In the given example, the document library is named Biographies, while the list is named Biography Details.
In the list workflow, add an action to create item in the document library.
Click on the document library name to set each field from the corresponding field in the list for all the relevant columns.
Having done this, the final mapping will appear as in the below image.
While all other fields can be edited or removed as desired, the only catch in the mapping process is to set the Path and name (*) field that is a non-removable field. This field essentially points to the file path, and it is required that this be set as illustrated below.
N.B.: Here Member Name is nothing but the Title column (primary column) of the document library or the list.
The workflow is now ready to be saved and published.
As details begin being entered or modified in the list, the workflow will make corresponding changes in the data of the document library and create corresponding documents.