我正在尝试以OR分割方式运行脚本,并且继续出现以下错误。根据此page,“ graniteWorkItem”包含在“立即可用于处理脚本的变量中,从而提供对工作流Java API对象的访问”(从链接中引用)。
观察:
有什么主意我做错了吗?
或分割脚本(有错误。请参见下文)
function check() {
var workflowData = graniteWorkItem.getWorkflowData();
return false;
}
动态参与者脚本(error.log中的graniteWorkItem没有错误)
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)
答案 0 :(得分:1)
我不是100%肯定的人,但是check()方法中是否没有工作流数据-如果不从工作项中获取它呢?