*Create a Document Set using a Workflow *
Steps we need to do:
- Create a document set
- Create a document library
- Create Custom List
- Add a column to the list and update the InfoPath form
- Create the workflow
- Verify the workflow association & test
Create a document set
Launch the site and go to Site Settings, and choose Site Content Types under Galleries
On the Site Content types page, choose Create at the top
On the New Site Content Type page, type a name for the Content Type, select the parent content type from the Document Set Content Types with the parent content type of Document Set. You can either leave it in the existing Custom Content Type group or create a new one.
Create a document library
Launch the site and go to Site Actions, More Options. We need to create a new Document Library that will contain our Document Sets. From the Create dialog box, choose Document Library and name the Document Library.
Within the document library, choose Library Settings, Advanced Settings. Since document sets are based on content types, we need to allow management of content types. For my purpose, I don’t want to allow new folders to be available so I choose “no” in that section and “no” to the datasheet settings.
In the Document Library Settings page, under Content Types, click “Add from existing site content types”.
In the Add Content Types page, select ProjectsDocSet from the Available Site Content Types and click Add, then OK
Back at the Document Library Settings page, under Content Types, choose “Change New Button Order and Default Content Type”. For my purpose, I didn’t want anyone to be able to upload a document and only wanted the document
We should now have the Document Set as visible and the default content type.
Create Custom List
Go to the list properties of the Projects list and create a column called DocSet. Set the type as a Yes/No check box with a default value of “No”.
On the Projects list, choose List under List Tools then select Customize Form.
The form will open in InfoPath 2010
Place the cursor at the end of the last line after “semi-colon” (shown by the arrow) and press the tab key. This will create a new row in the form.
Click DocSet on the right and drag the field to the colored column on the new row.
Next we need to add some text to the form so it makes sense to the user. Click in the colored area to un-highlight the field name.
Erase the word “DocSet” and add your own text similar to the following in both columns of the new row.
Now we need to publish the form. From the menu bar, click File, Publish, and click the SharePoint List button.
Let’s verify the form is correct when opening. From the list, click Items under List Tools and click New Item.
Create Workflow to Automatically Create a Document Set
Launch Microsoft SharePoint Designer 2013 (SPD) and open the site.
Once the site opens in SPD, click Workflows under Navigation, Site Objects.
Once Workflows is selected, the Ribbon shows the Workflow options. Click List Workflow and select the list that will be used for this workflow – in our case it is the PFELaunch Projects list.
Next, the Create List Workflow dialog box opens. Type a Name for the workflow and (optional) description, and then click OK.
In the Workflow editor, we need to put in the logic on when to create the document set.
In the section where it says “Start typing . . .”, type the letter “I” and press <enter>. Listings of all the possible options are shown. Select “If current item field equals value”.
Click the “field” hyperlink and scroll down and select DocSet.
Next, select the “value” hyperlink and choose “Yes”
Remembering our logic from before: IF DocSet from the Projects list is Yes, THEN create the document set using the same name as the title of the project, we have set the first condition – next we need to create the document set.
Below our “If” statement, type create and press enter to see our list of choices – choose “Create List Item”
After you choose “Create List Item” new Action
Click on “this list” hyperlink, select the down arrow next to List and choose ProjectDocuments.
Highlight “Content Type ID” and select “Modify”. Change the value of “Content Type ID” to ProjectsDocSet.
Once you have selected “Title” from the “Field from source” selection, click OK to close the “Lookup for String” dialog box, and then click OK at the “Value Assignment” dialog box. Your “Create New List Item” dialog box should now look like this:
Click OK at the Create New List Item dialog box – the completed workflow is now set.
From the breadcrumb at the top of SPD, click ProjectsCreateDocSet to go to the information and settings page of the workflow.
Select the Start Option of “Start workflow automatically when an item is created” and “Start workflow automatically when an item is changed.”
Close SharePoint Designer 2013
Verify the Workflow Association & Test
Launch the site and go to the projects list
Check to make sure the workflow is associated with the list by going into the List Settings and selecting Workflow Settings.
Go back to the list and select Items from the List Tools, then New Item. Complete the form and click Save making sure to check the box to create a document set
We have successfully created a new project with the DocSet set to yes. Let’s check our ProjectDocSets library to make sure the document set was created.