Right now i'm having a problem with sitecore workflow. The issue is as follows:
my template standard value has set the Workflow and Default Workflow fields set. The workflow state is set to draft. However, everytime i create an item from this template it is not inheriting the workflow section fields, all of them are empty
if i manually set workflow and workflow state for items, it works as expected up to the final state. However, if a content author edits the item, a new version is created but only the workflow field value is kept, while the workflow state is again empty.
what i'm doing wrong? why is this happening? I'm using sitecore 6.5.0
When you create the item via the API you appear to have to specifically set the workflow and the state explicitly:
I'm assuming that when you do it through the UI there are some extra pipelines that get processed that do this for you when using Content Editor etc, which you bypass by using the API.
In fact, here is a relevant post on SDN: http://sdn.sitecore.net/Forum/ShowPost.aspx?PostID=45991
The
__Standard Values
of your template should only have theDefault workflow
field set; do not set theWorkflow
field on the__Standard Values
item as that insinuates that the__Standard Values
item is itself in the workflow! Similarly, do not set theState
field on the__Standard Values
item as that is saying that the__Standard Values
item is in that state!Your Workflow item has an
Initial State
field on it that defines the initial state an item will be in (assuming the item uses that workflow).When you create an item, and that item has a
__Standard Value
with a workflow in theDefault Workflow
field, then that item will have itsWorkflow
field set the same as theDefault Workflow
field of its__Standard Values
. The state the item is in will be theInitial State
as defined on said workflow.