Posts in Category "Workflow"

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)

CQ5.5: SlingException running workflowreport.html

Issue

If you are using the workflow report under /etc/reports/workflowreport.html it may return with an error 500 in the browser and the following exception:

org.apache.sling.api.SlingException:
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:686)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:603)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:528)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:447)

Caused by: org.apache.sling.api.SlingException: An exception occurred processing JSP page /libs/cq/workflow/components/report/report.jsp at line 132
… 74 more
Caused by: java.lang.NullPointerException
    at org.apache.jsp.libs.cq.workflow.components.report.report_jsp._jspService(report_jsp.java:309)
    at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:497)
… 97 more

Reason

This problem can occur when a workflow model is deleted, but that workflow model had been used to start multiple processes, and therefore workflow statistics for that model exist.  This is a product issue and has been addressed in CQ5.6.

Workaround

As a workaround you can use the attached overlay for
/apps/cq/workflow/components/report/report.jsp
instead of the problematic
/libs/cq/workflow/components/report/report.jsp

workflow_report_overlay_40332-1.0.zip

The workaround will resolve the NullPointerException and the workflow report will display as expected, but there are still some unresolved exceptions in the server log. These will be resolved with the full product fix.

reference: (40332/CQ5-23798)

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

CQ5.4: how to force a delay between workflow steps

Information

If you are using workflows in Adobe CQ5.4 you may wish to have a customized delay between certain workflow steps.  It is possible to cause a delay using the timeout functionality which has pre-defined values (immediate, 1h, 2h, 6h etc…), and then select the Auto Advance timeout handler to move the workflow to the next step.

In some cases you may also want to define your own delay intervals rather than use the pre-defined values.  This is possible in CQ5.4 by creating an overlay of:

/libs/cq/workflow/components/model/step/tab_common/items/timeout/items/timeout/options

to:

/apps/cq/workflow/components/model/step/tab_common/items/timeout/items/timeout/options

and then you can make a copy of one of the existing nodes (1h, 2h etc…), and change the values to suit your needs.  The value should be in seconds and not milliseconds.

This new value will then appear in the workflow step configuration dialog, under the list of timeout values, and the step will timeout after the specified interval.

reference: (37175)

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