title: Can't set workflow and workflow state properties on sitecore items
body: <p>I am currently working on a project that requires me to set up a very simple sitecore workflow. I am running into some difficulties when modifying the existing items to use my new workflow. This is what i did:</p>
  
  <p>The workflow creates a new version when a contentmanager starts editing an item and publishes the item when the submit button is clicked.</p>
  
  <p><img src="https://i.stack.imgur.com/gbNxl.png" alt="Sitecore workflow items"></p>
  
  <p>I added these workflow items to the standard values of my templates:</p>
  
  <p><img src="https://i.stack.imgur.com/9paMB.png" alt="Workflow settings of standard values of templates"></p>
  
  <p>The next step would be to set the workflow settings on the already existing items. Luckily we can use sitecore-powershell to do this for us.</p>
  
  <pre><code>function SetWorkflow($item)
  {
      $item.__Workflow = "{DE29E564-3157-4CAB-81B1-87DF2E983517}";
      $item."__Workflow state" = "{27633BF0-B76A-4450-A139-BA53F6943778}";
  }
  
  get-childitem . -recurse -Language * | foreach-object { SetWorkFlow($_) }
  </code></pre>
  
  <p>This script runs without errors.</p>
  
  <p>Now the fun starts: When I opened the items I ran this script on the Workflow and Workflow state properties haven't changed. Weirdly enough, the editor says that the empty values are being inherited from the standard values, though the standard values are not empty, i have set these!</p>
  
  <p><img src="https://i.stack.imgur.com/KkQJq.png" alt="Workflow settings of the items"></p>
  
  <p>You'd say that the script maybe has failed and that no values have been set. Except when I look the values up in sitecore-powershell, i can see that the values are there.</p>
  
  <pre><code>get-childitem . -recurse -Language * | Format-Table Id, Language, __Workflow, "__Workflow state"
  
  ID                                                          Language                                                    __Workflow                                                  __Workflow state
  --                                                          --------                                                    ----------                                                  ----------------
  {208D79B1-5B42-4713-A7F9-F2109588F639}                      en                                                          {DE29E564-3157-4CAB-81B1-87DF2E983517}                      {27633BF0-B76A-4450-A139-BA53F6943778}
  {208D79B1-5B42-4713-A7F9-F2109588F639}                      nl-NL                                                       {DE29E564-3157-4CAB-81B1-87DF2E983517}                      {27633BF0-B76A-4450-A139-BA53F6943778}
  {3F3B1132-02DA-4E75-928F-BDB8AED5C3CD}                      nl-NL                                                       {DE29E564-3157-4CAB-81B1-87DF2E983517}                      {27633BF0-B76A-4450-A139-BA53F6943778}
  {8AF23DC5-E7FE-47E3-AC65-AA3D41D81F97}                      en                                                          {DE29E564-3157-4CAB-81B1-87DF2E983517}                      {27633BF0-B76A-4450-A139-BA53F6943778}
  {8AF23DC5-E7FE-47E3-AC65-AA3D41D81F97}                      nl-NL                                                       {DE29E564-3157-4CAB-81B1-87DF2E983517}                      {27633BF0-B76A-4450-A139-BA53F6943778}
  
  etc.etc.
  </code></pre>
  
  <p>I tried setting the workflow and workflow state properties on the items by hand. This works kinda, i can go through the workflow once. When a new version is added the workflow and workflow state properties default back to their 'empty' standard values which breaks the workflow for that item.</p>
  
  <p>Does anyone know what's happening here? How can I set the workflow and workflow state properties once and for all?</p>