I am currently working on a project that requires me to set up a very simple sitecore workflow. I'm having some difficulty modifying existing elements to use my new workflow. This is what I did:
The workflow creates a new version when the content manager starts editing the item and publishes the item when the submit button is clicked.

I added these workflow elements to the standard values ββof my templates:

The next step is to set the workflow parameters for existing elements. Fortunately, we can use sitecore-powershell to do this for us.
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($_) }
This script works without errors.
Now the fun begins: when I opened the elements that I ran, this script in the properties of the workflow and workflow has not changed. Oddly enough, the editor says that empty values ββare inherited from standard values, although standard values ββare not empty, I set them!

You would say that the script might not have worked and no values ββwere set. Unless I am viewing values ββin sitecore-powershell, I see that there are values.
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.
I tried to manually set the properties of the workflow and the state of the workflow on the elements. This works, I can go through the workflow once. When a new version is added, the default workflow and workflow state properties return to their "empty" default values, which interrupt the workflow for this item.
Does anyone know what is going on here? How can I set the properties of a workflow and the state of a workflow once and for all?
Wessel T.
source share