Posts tagged "workitem"

CQ5: Failure running script /etc/workflow/scripts/workitem.ecma: ReferenceError: “workItem” is not defined

Issue

If you are using custom ECMA scripts in workflows with CQ5, you may encounter an error similar to the following when executing the workflow:

*ERROR* POST /etc/workflow/instances HTTP/1.1] com.day.cq.workflow.rule.impl.ScriptingRuleEngine
Unable to execute rule /etc/workflow/scripts/workitem.ecma: Failure running script /etc/workflow/scripts/workitem.ecma:
ReferenceError: “workItem” is not defined (/etc/workflow/scripts/workitem.ecma#2)
org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /etc/workflow/scripts/workitem.ecma:
ReferenceError: “workItem” is not defined (/etc/workflow/scripts/workitem.ecma#2)

Reason

In an OR step for a workflow, only theĀ workflowData, jcrSession, and workflowSession objects are available to be used within the check() function.

Solution

You should use the workflowData, jcrSession, and workflowSession objects in your ECMA script to implement the logic.

reference: (44185/CQ5-11022)

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 6.5/10 (4 votes cast)