My SharePoint Log

SharePoint 101 Auto Create Documents based on SharePoint Designer Workflow

It’s been a while since I’ve built something with SharePoint Designer Workflow, I kinda missed it. ūüôā

An opportunity showed up, when i received a business request to automatically create documents based on a SharePoint list item. This post will describe the steps needed to make this work without custom development.

Business requirements:

  • A list item describing a meeting agenda
  • Automatically creates a new meeting documents based on the list item
  • The Document should have text prefilled out
  • If the meeting agenda is updated so should the document
  • If the meeting is confidential, the documents should be accessed only by site owners

Main Goal:

  • An overview of all upcommming meetings and their agendas
  • Automate the creation of meeting documents

End solution:

The solution for this is built with standard SharePoint List and 3 SharePoint Designer Workflows

  • One Custom List | containing meetings agenda and relevant data fields.
  • One custom document content type “Meeting Agenda” with the document template
  • One Document library | containing “Document Set” and custom word Content Type
  • The meeting content type will contain “Smart parts”
  • One Workflow for creating the document set and the meeting document
  • One Workflow for updating the document set
  • One Worfklow with impersonation for setting permissions

Preparations:

Before creating the workflows we need to create the custom lists we’ll need, enable the content types we need, then make changes to our word template file:

In SharePoint create a custom list named “Meeting Agenda”, with relevant fields, this is my sample:

workflow001

In SharePoint create a new content type “Meeting Agenda” | upload your document template

workflow002

In SharePoint create a new document library “Meeting Documents” | enable “Management of Content Types” then add “Document Set” and “Meeting Agenda” to the library.

workflow003

Add the custom colums you will use in the “Meeting Agenda” to the library, beware that this can also be created as site columns ect.

These columns will be added to the “Document Set” | and configured to inheritance | remember the “MeetingID” column we will use it to update list items.

workflow004

workflow005

In the advanced settings for the “Meeting Agenda” content type edit the word template

workflow006

Using “Quick Parts | Document Property” connect the columns you need to the tempalate then save the template:

workflow007

Creating workflows

Using SharePoint Designer 2013 login to your site | click workflow | list workflow |

Our first workflow is called “Create meeting doccument” attached to “Meeting Agenda” List

workflow008

SharePoint and SharePoint Designer sometimes encodes text, people pickers and date field differently, I then use Workflow variables to convert the data.

Example, i want the comments in “Plain Text”.

Then use the “Create list item” to create a new document set and Document based on the content types

workflow009

This actions creates the meeting documents | we don’t need to add all the colums as it will be added by the document sets.

workflow010

Create a new list workflow | this workflow will use the action “Update list item” | remember to filter the item using the “MeetingID” from earlier

workflow011

Our last workflow is attached to the “Meeting Document”

We will run a SharePoint 2010 Workflow “Impersonation Step” | Replacing the Document Set item permission with a new one.

workflow012

We will now have 3 Workflows

workflow013

“ChangeItemPermissions” | This workflow should run by creation and every time the document set changes

“Create meeting document” | This workflow should run only once when a new meeting agenda is created

“Update meeting document” | This workflow should run only when the meeting agenda list item is edited

Publish your work and test your solutionworkflow014

workflow015

This is how the “Meeting document” will look like when everything is done

workflow016

 

Happy “SharePoint’ing” | We’re not done with SharePoint Designer yet!!!

 

PS! in case someone wonder why I’m using “Document set”, it’s because some of the meetings sometimes have additional documents that should be included. Using the “Document Set” will allow uses to upload additional files that should be attached to the same meeting.

 

Use Custom Ribbon Action to launch Workflows – NO Code!!

Using SharePoint Designer 2013 we can now add simple ribbon actions to launch custom workflows

Create your custom List:

This is the normal item display ribbon:

Create your custom list workflow:

In SharePoint Designer navigate to your list | in the ribbon choose Custom Action | and the location where you want the action to show

Name your action and select “Initiate workflow”

Save it | refresh your page and you should now see your new Ribbon Action

Using the Ribbon Action will trigger the workflow to update the task status.