You will often find yourself happily creating your workflows in the same way you would do the task if you were manually doing the task. This is not always the most efficient way to build a workflow. When working with a workflow you want to take a look at your overall process, whether that is in a tree or routine and look for those parts of the process that

  • can or will be repeated
  • may need to be rerun separately from the rest of the process
  • may need to be versioned separately from the rest of the process

And these are the components you will want to make into routines that you will leverage in your main workflow.

A Routine is a workflow very much like a tree except that it does not take external data (are not connected to a source) but instead have defined parameters and return results much like a handler. Routines can be called from trees or from routines.

Repeating Processes

Repeating processes can be from something as simple as a two node combination used to send a notification or assign a ticket to a full approval process. Note that these repeating processes might have repeating processes within them as well. This also applies to repeating the same processes across workflows. As a general rule, if I find myself putting the same two (or more) nodes more than once, I stop and reconsider if what I'm doing should be made into a routine.

Complex or Error-Prone Processes

Say you have a process that connects out to a system that is not particularly reliable and you are more likely to have to retry things associated with this system. Isolating these things into a routine gives you the power to pause the routine if necessary, rerun the routine if necessary, or version it if necessary without affecting anything else in the workflow.

Complex or Distinct Subprocesses

Even if processes are not being re-used, they may be appropriate for a routine. For example, if you have an approval routine that is being used (repeated), it may have routines used within it for group approval and individual approval. Since everywhere approval is used, the approval routine is called, the group and individual approval routines aren't themselves used repeatedly. However, having them as separate routines allows them to be managed, supported, and versioned separately.