Jan 01, 0001
One of the most important aspects to a proper CMS implementation is workflow. Too loose, and you have content chaos - too restrictive and you have publishing bottlenecks. Fortunately Sitecore workflow is easy, flexible and powerful. It is easy to create/update workflows in the Sitecore content tree
At its heart workflow is a series of states, tasks and (optionally) actions.
There are really two parts to workflow;
- Creating the series of states and tasks, as well as applying roles to those
- Applying workflow to content items or item template defaults (i.e. all new items have this workflow applied automatically).
Users receive notifications via the Workbox - which can notify within Sitecore, or users can grab RSS feeds to be notified externally.
Workflow States and Tasks
Let's take a look at the Sample Workflow in Sitecore
The Sample Workflow consists of three states; Draft, Awaiting Approval and Approved.
The Draft state is the Initial State which is invoked when a user begins to edit some content. This happens in conjunction with locking the file.
As you can see, there are two tasks off this draft state, Submit and __OnSave
Submit is a Command, which simply moves the workflow to the next State.
__OnSave is a System Command, which has some additional parameters before then initiating the Command Auto Submit action. In this case, you can look at the properties of Auto Submit Action and determine that this is enabled for the Sitecore Role sitecore\Sitecore Minimal Page Editor.
So, in effect, all users get a workflow button for Submitting their work when they are done, except for those in the role sitecore\Sitecore Minimal Page Editor who have workflow kick off the moment they hit save. In both cases, the workflow moves to the next State which is Awaiting Approval. Note that if you select the drop-down for choosing the next state, you can actually select different workflows. Sitecore has the ability to jump from workflow to workflow - making it very easy to add, say, a Legal Approval step and not have to create a whole new set of workflows to optionally add this step - you can just call it from your existing ones.
The Awaiting Approval state is pretty straightforward, users can see this task in their workbox and approve or reject the content. You will note that Approve has a Validation Action applied - it simply uses the validation rules already enabled on the item.
Approve (assuming a successful validation) moves the content to the Approved state, Reject sends it back to Edit. If the item fails validation, a pop-up will inform the approver as to what failed.
When the item moves to the Approved State, it automatically calls the Auto Publish task. The Auto Publish task calls some external code with a parameter "deep=1" which tells the publish task to not only publish the item, but also any child items as well.
This is useful because it means that you can configure workflow to only require approval on major items - not necessarily child items which may not be as important. For example, if you have a product item with child items such as accessories, you don't need to workflow each and every accessory - just the main item. This has the overall effect of reducing the approval load on your editorial staff.
Implementing workflow in Launch Sitecore.
Since most developers are evaluating Launch Sitecore as individuals, we use a simple workflow, however, you can add additional steps. If you are evaluating Sitecore by implementing this site on a shared environment and want to make the workflow more robust, you should go through the following steps, determining the following:
- Which content to apply this workflow to.
- Which users should action each step.
Applying workflow to content
This is done in the same way as many other Sitecore configuration - either applied to the item itself, or on the Standard Values of the templates that items are based on. Let's assume we want to enable workflow for just the Articles. Go to the template /sitecore/templates/Launch Sitecore/Article/ and look at the __Standard Values. Go to the workflow section of the Standard Values item (if you can't see it, you may have to enable View > Standard Fields as this is a 'system field' and sometimes this view is hidden from users). Under Default Workflow, select Sample Workflow.
Applying Users to steps.
Obviously most workflow is structured such that a different set of users is approving the content.
For each item under the Awaiting Approval state - modify the security permissions (also a 'system field') to assign a user/role different than sitecore\client authoring to action these states and tasks.
Using Sitecore Rocks to create Custom Workflow actions
Sitecore makes it extremely easy to develop tasks with external functionality. If you have downloaded Sitecore Rocks, there is even a pre-built stub template for building an external workflow step.
To include your compiled code in a Sitecore workflow, simply create a new action and reference the assembly and namespace/class of your code (i.e. LaunchSitecore.WorkflowAction1,LaunchSitecore - if you accepted all the defaults for your LaunchSitecore solution)
Additional Workflow customization on the Sitecore Shared Source network.
There are a number of workflow customizations such as escalations or using Velocity templates for email notifications available on the marketplace.