SharePoint Workflows: Best Practices and Extending WorkflowsThanks for staying with me as I walked you through the basics of workflow in our favorite intranet platform – Microsoft SharePoint (and I’ll see you at the Ignite Conference at the end of the month!). 

To wrap up our series, I wanted to talk a little about some best practices with workflow then offer some ways that you can extend your workflows.  Quick recap of where we are:

Part 1: Intro and Core Concepts

Part 2: Templates and Using Workflows

Part 3: SharePoint Designer and Creating Workflows

Part 4: Best Practices and Extending Workflows (this post)

Everything below I will cover here will be from the front end of SharePoint, for the power user / business user / site admin.  There are other resources that go into detail for IT or server admins to troubleshoot the service itself like this blog on MSDN.

Let’s take a look at some ways that you can use and create workflows responsibly. 

SharePoint Workflow: Best Practices and Troubleshooting

I’m mixing best practices and troubleshooting together, because for the power user, they go hand in hand and there’s only so much you have control over. 

Plan Your SharePoint Workflow Before Ever Opening Designer

Planning SharePoint WorkflowsThis is by far one of the biggest tips I can recommend.  Unless all you want to do is send a one-line email, it will be helpful to write out your process beforehand.  This can be as simple as a bullet-list on paper, OneNote, Word or a written out process with Visio flow diagrams. 

This is usually in two parts:

  1. Document the business process
  2. Identify what parts of that process to automate with a workflow

A while back I helped a client build a workflow to automate their new position requests.  The entire process involved getting a position requisition approved, getting candidates and interviewing them, making an offer, then on-boarding that candidate.  They used an outside system to handle the interviewing process, and for on-boarding some emails had to be directed to IT to set up their accounts (as well as a few other things).  Our workflow was primarily centered around the initial position request form and approval. 

You can’t make any decisions about how you will technically write your workflow until you’ve thought through all the process, what will be involved, what data you need to collect and where you will need to use it. 

If you jump right into SharePoint Designer, you can design yourself into a corner because you didn’t account for a particular requirement.

Use SharePoint Workflow Logging More Than You Should

One thing you should know is that there is no way to really troubleshoot your workflow like being able to have it pause mid-run and see what it thinks values are, etc.  So there’s an action called Log to History List.  Use that action everywhere!

  • Before and after you enter certain steps or stages
  • Use it to dump a list of variables to check what values are being used, and to check perhaps some calculations, due dates, etc.
  • Before or after certain actions or conditions, to tell if you entered the IF part or the ELSE part

Once you’ve got your workflow good, you can always remove SOME of it, but everything you put here shows in the workflow history and lets you see from the workflow status.

Use Login Name for Sending Emails

SharePoint Workflows - who should email come from?This is only a requirement in some cases, but just good practice.  Whenever you use the send an email action in workflow, you can define the person or group it goes to.  Whenever you use a variable (or a Person field), you have control over what format you return. 

For example, in our email action, let’s say I just want to email the person who create the file.  I can choose the Current Item: Created By field.  You will have a “Return field as” option.  Normally, you would think use Email Address.  Nope, that will not work.  I know its counter-intuitive, don’t ask me. 

Updates to SharePoint workflow actionsYour best bet is to use Login Name instead.  So my name is Doug Allen, which is the Display Name.  But your login would be like “domain\username”.  The thing here is that your login name is guaranteed to be unique in the system.  Let’s say you had multiple accounts for John Smith.  If you left it Display Name, it wouldn’t know which account to get, and would give an error.  Using Login Name will always work.

Know How SharePoint Workflow Actions Have Changed in 2013

Only read this if you have SharePoint 2013 or higher.  I mentioned in part 3 that there were some differences between the actions in 2010 and 2013.  So users always me:

“Which workflow platform do I use, 2010 or 2013?”

Well, it depends.  I would say try 2013 but look at the actions to make sure they will do what you want.  If you find something you need from 2010, you will have to use that.  2013 gives you a lot of great stuff like stages, looping, copy/pasting actions, but it take away some things. 

  • You can’t set content approval with 2013 actions
  • You can’t easily looking a person’s manager
    • You can still do it, but requires a more complex (but more flexible) web service call
  • Tasks and task processes are vastly different
    • Individual assign a to do item in 2010 was limited but now has a lot more options in 2013
    • Task processes in 2010 had a TON of flexibility and options, but has been drastically simplified and capable of one set of approvers per task process

So review the list of actions that were removed from 2013, then review the list of actions available in 2013. 

SharePoint Workflow Isn’t Always the Best Answer

Workflow can do a lot, but it’s not always the best tool for the job every single time.  A good example of this is a reminder. 

Say you want to remind someone of a due date 1 month, 2 weeks, 3 days than 1 day before, and every day after.  If you do this in workflow, you could have your workflow start then just pause till each of those dates.  That works, but it would require stay running for more than a month, which means you would have a workflow per item running for that long.  That can eventually really over burden the system.  I wrote up an example of this in a previous blog.

Workflows are best when they run for a short time, do their stuff, then stop.  But there’s easy no out of the box mechanism to trigger your workflow without something custom.  You can do some hackery to make a workflow that calls another workflow, but it’s not my favorite. You could use the built-in mechanism called Information Management Policies which would fire the workflow based on an expiration date.  But you can’t make it do what you want for all your dates as it’s one and done trigger.

Here are a couple ways to solve the same problem without workflow or with help:

  • Use Alerts for simplistic needs
    • You can create a view that has a filter to match your criteria, then just set an alert to fire on new items on that view
  • If you want to use a workflow, you can get HarePoint’s Workflow Scheduler for FREE.  It can trigger your workflows on whatever schedule you set.
  • Use a third-party tool like Boost Solutions’ Alert Reminder or SharePoint Reminders from Pentalogic (or other). 
  • Use a PowerShell script
    • IT would have to get involved here as it requires server access, but could be set to fire as a scheduled Windows task, and do anything you want.  And it’s free!

Use Pauses When Creating SharePoint Items

SharePoint errors when creating list items from workflowYou can create an item in a list for example in a workflow, then use that item’s properties in the rest of your workflow.  Sometimes, SharePoint goes too fast, and you will start getting errors because the workflow proceeded before the item creation finished. 

So what you can do is define your create item action, then add a “Pause for Duration” action, like 1 minute. 

Don’t Forget SharePoint Permissions

Working with permissions in SharePoint workflowsIn my final tip I just wanted to mention to forget to plan your security.  This can come into play if you need to restrict who can complete approval tasks, update item metadata, or see content in a list or library by view.  Just building a workflow is only part of the solution, you will need to create your lists, libraries, views, security as well to build a real-world solution.

Also, remember I mentioned workflows run as the context of the user who started them.  If that’s low-privilege user, you might need to use an Impersonation Step (2010) or App Step (2013).

Extending SharePoint Workflows

Workflows are pretty powerful and can do a lot, but there are places where they fall short. 

SharePoint Workflow Extensions

To help fill those gaps, some companies like HarePoint, Virto Software and Plumsail make Workflow Extension tools.  They’re similar in nature in that they both other like 270 more actions, and both offer a free option that includes basic additional actions for text manipulation and the like.  I’ve only used HarePoint myself, but they offer a ton of additional functionality.

Where it gets crazy cool is where you can run PowerShell scripts or even execute compiled C# code inside your workflow!  HarePoint offers PowerShell, and they both can execute code.  That opens up just about anything you can imagine for your developers. 

Compare their activities and see if which might best fit your needs (HarePoint, Virto Software, Plumsail).

SharePoint Workflow Platforms

If you so like, you can look at new workflow platforms like Nintex or K2.  This can entirely augment or even replace the default workflow platform with their own.

BPMS Tools

BPMS: Microsoft Flow, Agile Point, NintexThis is really more of a instead of workflow tool.  Business Process Management System tools are made to provide a platform is designed to interact with various data sources to complete a business process.  Go get data from an HRIS system, send email, create an item in SharePoint, a new user account in AD and CRM, etc.  There are many, but can include tools like AgilePoint, and now Microsoft PowerApps/ Microsoft Flow

Thanks very much for spending your time with me during this series, I hope it was useful for you!  Please reach out and contact us if you need any help with workflow or automating business processes!