Adobe AEM 6.4.x 工作流程:在 OR 拆分中使用时未定义 graniteWorkItem
Adobe AEM 6.4.x workflows: graniteWorkItem is undefined when used in an OR split
我正在尝试 运行 OR 拆分中的脚本,但我不断收到以下错误。根据此 page,"graniteWorkItem" 包含在 "variables that are immediately available to process scripts, providing access to objects of the workflow Java API" 的列表中(引用自 link)。
观察:
- 我试过 "workItem" 我认为这是 CQ5 的变量?同样的错误。
- 我删除了 OR 拆分,然后插入了一个动态参与者步骤。在参与者选择器上,我选择了 Workflow Initiator Participant Chooser (Script)。然后我使用下面的代码并勾选 "email"。我尝试了 "workItem" 和 "graniteWorkItem" 变量名。我 运行 我的另一个帐户下的工作流程并使用两个变量名称,我收到一封电子邮件并且 error.log
中没有错误
知道我做错了什么吗?
或拆分脚本(有错误。见下文)
function check() {
var workflowData = graniteWorkItem.getWorkflowData();
return false;
}
动态参与者脚本(error.log 中的 g运行iteWorkItem 没有错误)
function getParticipant() {
return graniteWorkItem.getWorkflow().getInitiator();
}
来自 error.log
的错误
> tail -f error.log | grep -i "graniteWorkItem"
var workflowData = graniteWorkItem.getWorkflowData();
} : Failure running script /libs/workflow/scripts/dynamic.ecma: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /libs/workflow/scripts/dynamic.ecma: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
var workflowData = graniteWorkItem.getWorkflowData();
com.adobe.granite.workflow.WorkflowException: org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /libs/workflow/scripts/dynamic.ecma: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
Caused by: org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /libs/workflow/scripts/dynamic.ecma: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
我不是 100% 确定,但 check() 方法中的 workflowData 是否不可用 - 无需从工作项中获取它?
我正在尝试 运行 OR 拆分中的脚本,但我不断收到以下错误。根据此 page,"graniteWorkItem" 包含在 "variables that are immediately available to process scripts, providing access to objects of the workflow Java API" 的列表中(引用自 link)。
观察:
- 我试过 "workItem" 我认为这是 CQ5 的变量?同样的错误。
- 我删除了 OR 拆分,然后插入了一个动态参与者步骤。在参与者选择器上,我选择了 Workflow Initiator Participant Chooser (Script)。然后我使用下面的代码并勾选 "email"。我尝试了 "workItem" 和 "graniteWorkItem" 变量名。我 运行 我的另一个帐户下的工作流程并使用两个变量名称,我收到一封电子邮件并且 error.log 中没有错误
知道我做错了什么吗?
或拆分脚本(有错误。见下文)
function check() {
var workflowData = graniteWorkItem.getWorkflowData();
return false;
}
动态参与者脚本(error.log 中的 g运行iteWorkItem 没有错误)
function getParticipant() {
return graniteWorkItem.getWorkflow().getInitiator();
}
来自 error.log
的错误> tail -f error.log | grep -i "graniteWorkItem"
var workflowData = graniteWorkItem.getWorkflowData();
} : Failure running script /libs/workflow/scripts/dynamic.ecma: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /libs/workflow/scripts/dynamic.ecma: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
var workflowData = graniteWorkItem.getWorkflowData();
com.adobe.granite.workflow.WorkflowException: org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /libs/workflow/scripts/dynamic.ecma: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
Caused by: org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /libs/workflow/scripts/dynamic.ecma: ReferenceError: "graniteWorkItem" is not defined. (NO_SCRIPT_NAME#2)
我不是 100% 确定,但 check() 方法中的 workflowData 是否不可用 - 无需从工作项中获取它?