Workflow is tightly integrated into the Sitefinity CMS publishing process. Although you cannot see it in the user interface, even if you don’t define a workflow, Sitefinity CMS uses a default definition. This definition moves an item between several default states: draft, published, scheduled and unpublished. These default states are applied for items in all built-in content modules, unless you have defined another type of workflow. Although very similar, the default workflow should not be confused with content lifecycle.
Unlike the lifecycle, with workflow an item can be in only one state. When switching the workflow state, this actually changes the item, rather than creating a new row in the database. There are no new rows in the database, only new values in the existing rows for each item. Here is the meaning of default workflow states:
The diagram above shows how an item can move between the different states of the default workflow. Circles represent states, arrows represent actions that can be performed with content items. Those actions can be performed both from the Sitefinity CMS user interface, as well as the API.
A rule you can follow when dealing with lifecycle and workflow is that the workflow state of an item is always applied to the Master version in the lifecycle. This means that workflow does not have any meaning for Temp and Live versions.
To see how each action affects an item, you can observe the state of the database and the user interface of Sitefinity CMS, similar to how you did with the content lifecycle.
Publishing the item creates a Live version in the lifecycle, and sets the workflow state of both Live and Master versions to Published.
When publishing the item through code, it is not enough to call the Publish method for the lifecycle - that would only create a live lifecycle version. To instruct the workflow that it should also change the state of the item to Published, you need to call WorkflowManager.MessageWorkflow().
This completes the sequence of steps through which you have moved a news item. Remember that while content lifecycle keeps several versions of an item, the default workflow operates on the master version by changing its status property. Knowing the difference between the two is important, and will become more evident when working with non-default workflow. You will discuss advanced workflow scenarios in the next topics of this section.
Following is a code sample that demonstrates the above operations:
Sign up for our free beginner training. Boost your credentials through advanced courses and certification. Register for Sitefinity training and certification.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important