Unable to set workflow properties and workflow states in sitecore files

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.

Sitecore workflow items

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

Workflow settings of standard values ​​of 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!

Workflow settings of the items

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?

+7
workflow powershell sitecore
source share
1 answer

In the default values ​​of the base template, have you set the workflow to the Workflow ? It really needs to be set in the Default workflow field. The remaining 3 fields are the fields of the current state, that is, they save at what stage of the workflow the element is currently located, they should be empty in your template and standard values.

Additional information from section 3.3.1 Link to Sitecore desktop :

Assign workflows to items

By default, items are not placed in the workflow upon creation. Sitecore only places items in the workflow if the "Initial" workflow is set for the item's standard template values ​​for the corresponding data. The initial workflow corresponds to the Default Workflow field in the standard template.

+3
source share

All Articles