I'm trying to run a script in an OR split and I keep on getting the error below. According to this page, "graniteWorkItem" is included in the list of "variables that are immediately available to process scripts, providing access to objects of the workflow Java API" (quoted from the link).
observations:
Any ideas what I'm doing wrong?
OR split script (with error. see below)
function check() {
var workflowData = graniteWorkItem.getWorkflowData();
return false;
}
dynamic participant script (no error with graniteWorkItem in the error.log)
function getParticipant() {
return graniteWorkItem.getWorkflow().getInitiator();
}
error from 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)
I am not a 100% sure, but isn't workflowData available in the check() method anyway - without taking it from a work item?