Sitecore Workflow
Sitecore Workflow allows a sequence of connected steps to be constructed which represent a the flow an item will pass through from creation to being available in the content delivery environment. Each step defines the states a content item can be in, the state transition, the commands which will be used to move a content items from one state to another and any actions that should be executed as the content item moves from one state to another.
Workflow States
A workflow must always have an initial state and there must be a final state. An item will first be available for publishing to the content delivery environment when it is in the final state.
When an editor chooses to edit an item which is in the final workflow state a new version of that item will be created. It can therefore be necessary to implement some form of version clean-up strategy for items that are updated often.
Workflow Commands
A workflow command allows users to move a content item from one state to another.
Workflow Actions
Workflow actions can be used to run .Net code when an item changes workflow state or a workflow command is executed.
How to apply a Sitecore Workflow to items
Attaching a workflow to a template standard values
To apply a workflow to all items based on a specific template, the workflow should be assigned on a templates standard values in the Workflow section. The Default Workflow field of a template's standard values is be used to specify the workflow that items will placed under when editors create and maintain items based upon that template.
Attaching a workflow to a content item
The standard workflow can be overriden by selecting the workflow for a content item directly on the item itself. This can be done manually or programmatically.
The Sitecore Workbox
The Sitecore Workbox is used to manage content items which are under workflow. The Workbox allows editors to gain an overview of the different workflows available in the Sitecore installation and for each workflow, the state of them content items. A content editor can perform a number of tasks upon a content item from the workbox and it can be used to quickly navigate to content items requiring editing or approval.
Sitecore workflow field ids
Sitecore.FieldIDs.Workflow
Sitecore.FieldIDs.WorkflowState
Take a quick look at Sitecore's Workflow in Action
Workflow experiences from the trenches
Scenario: Our customer had a Sitecore configured with several workflows. Editors reported that when approving a single language version of some items via the workbox, all language versions of that item disappeared from the Sitecore Workbox.
Cause: The items where this behaviour was observed, were configured with a workflow that included a workflow command __OnSave in the workflows final state, which switched an item to another workflow and place the language version in a draft state from the new workflow. However as the workflow field of an item is a shared field, all language versions of that item now fell under the control of the new workflow. As the other language versions had not been approved they were in a workflow state from the original workflow. The workbox was unable to display items with this mismatch of workflow and workflow state.
Resolution: It was a requirement for items approved in the original workflow, to switch over to another workflow. The workbox was modified to include items with a mismatch in workflow and workflow state.
Scenario: Several thousand items, each configured to be under workflow, are modified via a batch job. When approving the all the items via the workbox, editors a presented by a dialog box for each item which displayed the results of content validation.
Cause: Validation was triggered by a workflow command in the approval step of the workflow.
Resolution: The workflow being used was used to import validated data from a service. Any validation issues discovered when approving items was due to errors in the original data. A validation step was put in place to validated content prior to requesting data from the service.