Sitecore workflow works with glitches

Current post is related with sitecore upgrade to the 6.5 version. So, after update I’ve noticed that with Sample Workflow something is going wrong, and it does not work. Items are creating without proper workflow state even after I set it explicitly through behind code like this:

 

item.Fields[Sitecore.FieldIDs.Workflow].Value = "{A5BC37E7-ED96-4C1E-8590-A26E64DB55EA}";
item.Fields[Sitecore.FieldIDs.WorkflowState].Value = "{190B1C84-F1BE-47ED-AA41-F42193D9C8FC}";

this trouble occurred because the Workflow and Workflow State fields are no longer inheriting their values from the template standard values. This change has been implemented to significantly improve the performance of the Workbox. Please take a look at the ref#328243 in the release notes. This is means that Workflow field must not contain a “standard value” marker for item, see figure:

Workflow

So, now you should use the Default Workflow field with Standard Values instead of Workflow and Workflow State fields:

Template:

Workflow

Home node:

Workflow

After of inserting of new item:

Workflow

Here and here you can find info about how does workflow work. And be careful about inheritance, as parent items also can have standard values.

Inheritance