Sitecore 工作流程不起作用 [英] Sitecore Workflow Is Not Working
问题描述
我已经有一个带有模板 A 的内容项(项).模板 A 最初没有设置任何工作流,我在模板的标准值中设置了一个新的工作流.
I already have an content item (item) with template A. Template A has not set any workflow initially and I set a new workflow in template's standard value.
如果我转到内容项的工作流程部分,则只有默认工作流程"更新.即使我在工作流的属性中设置了初始状态",字段工作流"和状态"也是空的,如下图所示.因此,工作流程不适用于该项目.
If I go to the content item's workflow section, there is only "Default workflow" update. The fields "Workflow" and "State" are empty even I set "Initial State" in the workflow's property, as shown below screenshot. So, workflow process is not working on that item.
但是,如果我使用模板已经设置的工作流创建新项目,我可以根据其初始工作流设置看到所有填充的工作流字段.因此,工作流过程完美运行.
However, if I create new item with the template already set workflow, I could see all filled workflow fields based on its initial workflow setting. So, workflow process is perfectly working.
我有很多页面没有设置工作流,我准备在其模板中分配新的工作流.
I have a number of pages without workflow setting and I'm about to assign new workflow in its templates.
我该如何解决这个问题???????
How can I solve this issue???????
推荐答案
我使用了 Powershell Script,它看起来像这样.它会更新空字段并完美运行.
I used Powershell Script and it looks like this. It updates the empty field and perfectly works.
##################################################################
## 1. Set default workflow state in template's standard value ##
## 2. Before running script, must set correct Context Item ##
##################################################################
function SetWorkflow($item)
{
## Update only items assigned __Default workflow
if ($item."__Default workflow" -eq "{A5BC37E7-ED96-4C1E-8590-A26E64DB55EA}") {
$item.__Workflow = "{A5BC37E7-ED96-4C1E-8590-A26E64DB55EA}";
$item."__Workflow state" = "{190B1C84-F1BE-47ED-AA41-F42193D9C8FC}";
}
}
## Update correct workflow information.
get-item . -Language * | foreach-object { SetWorkFlow($_) }
get-childitem . -recurse -Language * | foreach-object { SetWorkFlow($_) }
## Show Updated Result
get-item . -Language * | Format-Table Id, Name, Language, __Workflow, "__Workflow state", "__Default workflow"
get-childitem . -recurse -Language * | Format-Table Id, Name, Language, __Workflow, "__Workflow state", "__Default workflow"
这篇关于Sitecore 工作流程不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!