Welcome to part 2 of our introductory blog series on SharePoint workflows.  In our initial foray into the depths of workflows in Part 1, I introduced you to the concepts of SharePoint workflow.  We laughed, we cried, then we talked about all the core basics with types, what they are and what they can do. 

SharePoint Worklfows

Now that we have gotten all that out of the way, we can venture deeper into the depths of your workflow adventures.  We’ll cover how to use the default workflows, more details on workflow structure and we’ll wrap up with working with workflows.  In the next post, we’ll crack open Designer to see how we can create some workflows. 

Part 1: Intro and Core Concepts

Part 2: Templates and Using Workflows (this post)

Part 3: SharePoint Designer and Creating Workflows

Part 4: Best Practices and Extending Workflows

SharePoint Workflow Concepts – Templates and Forms

Templates

When you create a workflow, you’re really doing two things:

  1. You are creating a workflow template
  2. You are associating that workflow template to a list or library

If you are using a List workflow, #2 happens automatically when you publish it.  If you are publishing a Reusable workflow (remember part 1?), then after you publish it, you have to manually associate it to the list yourself.  This is what you do to use the out-of-the-box workflow templates I discussed in part 1, and I’ll show you how to use shortly.

Once a workflow template is associated to a list or library, it can be used.  It runs on a specific single item (list) or file (library), so each time it runs, you are running an instance of that workflow template on that item.

I had to explain templates so we could discuss another component of the workflow – forms.  There are two types of forms that are outside of the workflow itself:

  • Initiation form
  • Association form

Let’s go through what these are.

SharePoint Workflow Initiation Forms

This is more relevant for the 2010 workflow platform, not 2013.  The initiation form is what you might see when you manually start a workflow (or “initiate”) the workflow on an item.  When you start a 2010 workflow, you will get a form that you have to confirm to start.

SharePoint 2010 list initiation form

This can be a pain or a blessing depending on what you want to do.  You will see this if you built a custom list workflow or reusable workflow, but if you are using one of the default approval workflow templates, you will see a much more built out form.

SharePoint 2010 approval initiation form

The purpose of the initiation form is that you can provide ad-hoc inputs into the workflow at runtime.  So you can code your workflow to read these values, and use those instead of hard-coding the workflow.  So for approvals, it would be very common for the approvers, due date or other values to change from time to time.  The default values here can be supplied from within the workflow.

I also want to mention these are InfoPath forms, and can be customized.  To change text on this form, with the workflow open in Designer, click on the form name under Forms, make your edits and publish. 

Infopath forms in SharePoint 2010

To add fields to your initiation form, in the workflow editor, in the upper right, click the Initiation fields button.  Don’t worry, we will get to SharePoint Designer very soon.

Add initiation form buttons

In the workflow editor, you can access the values entered by the user on this form:

Access SharePoint initiation field values in workflow

SharePoint Workflow Association Forms

You only see Association forms when using reusable workflows (remember its just a template, and you have to add it where you want to use it).  When you add a reusable workflow to a list or library, you will see this form from which you will pick the template.  Notice the form type now says association and not initiation:

SharePoint 2010 association form

See SharePoint 2010 association form in workflow

When you add the workflow and fill out the association form, the workflow will use these values as defaults when you manually run an instance of the workflow (which then you can adjust if needed).

Using and Working with Workflows

Now let’s work with some workflow.  I’ll show you how to use the default workflows, see their status and start them manually.

Adding a Default Workflow

Remember, the built-in workflow templates are reusable workflow templates and we need to add them first before we can use them.  For these steps, we’ll add the most common template, the Approval workflow.

  1. Go to your or library where you want to have an approval process.

  2. Choose the template you want to use.  In our case, choose Approval – SharePoint 2010.

  3. Give it a name.  The name you choose will show as a column in the list or library and store the status of any workflow running.  I’ll enter Purchase Approval.

Add a SharePoint 2010 Workflow

  1. For the task list and workflow history list, you can leave them default.  It will either use existing lists if they exist, or it will say “create new” in which case the workflow will create these lists for you. 

  2. Every workflow instance has an associated task list and workflow history list.  If your workflow ever assigns to do tasks, they will be created in this list.  Every workflow will use a history list to log information as it runs.  It’s a hidden list by default that you can’t see in the UI. 

  3. Choose your Start Options. 

  4. Now what you check here will depend on your required business process.  If you’re just testing, only check the Start Manually.  This is also used when users need to upload a document, fill out some properties, wait a while, review the metadata, and THEN start the approval.  In this case, only check this option and not others.  You can also raise the permission needed to start a workflow.  By default, any user with basic Contribute rights can start a workflow.  If you click this additional checkbox, it will require users have higher permissions to start a workflow.

  5. If you want the approval request to start as soon as someone uploads a document, click that option.

  6. If you want the approval to run when a document is updated, click that option.

  7. Click Next.

  8. Complete the defaults for the approval process (approvers, due dates, etc.).  I’ll just call out a couple options.

  9. Participants – here in 2010 you can have multiple layers of approval.  For example, you can define a group of 5 approvers that should all be requested in parallel, followed by an additional approval with 2 individual approvers in sequence.

  10. Request – this is the text of the task that will tell the approvers what to do.

  11. End on X – these are helpful options used depending on your process.  You have 10 approvers, what if Bob rejects but all others approve?  Is it still “approved”?  What if someone changes the document while it’s in process of being approved?  Does that invalidate the approval and require it start over?

  12. Click Save.

.SharePoint 2016 add an approval workflow association

You’ve added the workflow!  Ok now what? 

Starting a Default Workflow

Now that the workflow is associated, we can start it.  Upload a document to your library and do the following:

Starting a Default SharePoint Workflow

  1. Highlight the file, and either use the Items tab of the ribbon or the list item dropdown to choose the Workflows (or in 2013, the 3 dots twice then Workflows).

  2. Under the Heading “Start a New Workflow”, click on Purchase Approval.

  3. Now we’re on the initiation form for this workflow.  We’re leaving it default, and click Start.

That’s it.  The workflow will start either immediately or after a minute depending on your environment, and you should be returned to your library view.  You will see a new column named “Purchasing Approval”, and it should say “In Progress”. 

Checking a SharePoint Workflow’s Status

As I mentioned before, this new column represents the current status of the workflow. 

SharePoint workflow status

To see what’s going on with any workflow, just click on the column value (in my case it’s currently In Progress.  We are taken to the workflow history page, where we can see an overview of what’s happened with this workflow.  We see who started it, when, on what document, any task status, and related entries from the workflow history (log).  As a workflow runs, you can tell it to write information out to the workflow history.  This is very very handy to keep track of where it is, what it’s doing, and what it thinks certain values are.  In my case, I see that it assigned me a to do approval task, but it failed to send some email with an error.

SharePoint Workflow History Page

Stop a Running SharePoint Workflow

NOTE: From this page (and this page alone), you can also stop a running workflow.  At the very top of the page, click the link that says “End this workflow”.  All open tasks will be cancelled, and the workflow will be stopped.

Stop a SharePoint workflow

The status of the workflow will be set to Canceled.

Removing a SharePoint Workflow

Lastly, I showed you how to ADD a workflow, but how do you REMOVE one?  Easy:

  1. Go to the list or library where your workflow is associated.

  2. Click the List or Library ribbon tab, and click Workflow settings –> Workflow Settings.

  3. Then click Remove, Block, or Restore a Workflow.

  4. Any workflows associated will show here PER INSTANCE.  To remove a workflow, just find the line for the workflow instance you want to remove, and click the Remove radio button and click Ok.  

This can be a little confusing.  Over time, you will make a lot to changes to a workflow and re-published it.  Let's say you make 20 updates and re-publish 20 times: you will have 19 copies of the workflow that all say “Previous Version: <date>” on its name.  Every time you publish a change to your workflow template:

Remove a SharePoint workflow

  • it updates the main instance in every library where that template is used. 
  • The new one just becomes “Purchasing Approval”, and the last one becomes “Purchasing Approval (Previous Version: <date>)”. 
  • It will also automatically set all previous versions to No New Instances and only the last current instance is set to Allow. 

Remember, workflow status is tied to the workflow instance.  So yes, for cleanness, you can remove all previous versions and just keep the primary current one.  BUT, just know when you remove a workflow instance, you also remove all statuses for that instance.  So if a workflow had Approved for its status, it will get blanked out.

 SharePoint workflow previous versions

One final note.  The workflow is NOT DELETED when you remove it from the library.  You are only breaking the association between the two.

Light at the End of the Tunnel

We’re just getting to the good stuff!  Hang with me, and next time we’ll dive into SharePoint Designer and look at all we can do with workflows.