In regards with the "destination-folder" issue, I was able to pull this from the log stating the property for "destination-folder" is undefined but is defined in the bpmn file.
Catalina.out:
2019-03-04 11:21:09,959 ERROR [impl.interceptor.CommandContext] [http-apr-8080-exec-6] Error while closing command context
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 020451608 Failed to execute supplied script: 020451607 TypeError: Cannot set property "destination-folder" of undefined to "org.mozilla.javascript.NativeJavaObject@71a6528f" (AlfrescoJS#8)
at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:742)
at org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:184)
at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:52)
at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:24)
at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:59)
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:178)
at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.endNormalTask(ActivitiWorkflowEngine.java:1417)
at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.endTask(ActivitiWorkflowEngine.java:1391)
at org.alfresco.repo.workflow.WorkflowServiceImpl.endTask(WorkflowServiceImpl.java:1035)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.service.cmr.workflow.WorkflowPermissionInterceptor.invoke(WorkflowPermissionInterceptor.java:109)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy72.endTask(Unknown Source)
at org.alfresco.repo.workflow.TaskUpdater.transition(TaskUpdater.java:143)
at org.alfresco.repo.forms.processor.workflow.TaskFormPersister.persist(TaskFormPersister.java:188)
at org.alfresco.repo.forms.processor.workflow.TaskFormPersister.persist(TaskFormPersister.java:1)
at org.alfresco.repo.forms.processor.workflow.AbstractWorkflowFormProcessor.internalPersist(AbstractWorkflowFormProcessor.java:87)
at org.alfresco.repo.forms.processor.FilteredFormProcessor.persist(FilteredFormProcessor.java:138)
at org.alfresco.repo.forms.FormServiceImpl.saveForm(FormServiceImpl.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:41)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy162.saveForm(Unknown Source)
at org.alfresco.repo.forms.script.ScriptFormService.saveForm(ScriptFormService.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_forms_form_post_json_js_9._c_main_1(classpath*:alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js:57)
at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_forms_form_post_json_js_9.call(classpath*:alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74)
at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_forms_form_post_json_js_9._c_script_0(classpath*:alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js:91)
at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_forms_form_post_json_js_9.call(classpath*:alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_forms_form_post_json_js_9.call(classpath*:alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
at org.mozilla.javascript.gen.classpath__alfresco_templates_webscripts_org_alfresco_repository_forms_form_post_json_js_9.exec(classpath*:alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:509)
at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:207)
at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:219)
at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:181)
at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:109)
at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1376)
at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:519)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:587)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:656)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:428)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:308)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:399)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.module.aosmodule.service.ContextRootFilter.doFilter(ContextRootFilter.java:93)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2492)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.activiti.engine.ActivitiException: Exception while invoking TaskListener: 020451608 Failed to execute supplied script: 020451607 TypeError: Cannot set property "destination-folder" of undefined to "org.mozilla.javascript.NativeJavaObject@71a6528f" (AlfrescoJS#8)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.notify(ClassDelegate.java:123)
at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:740)
... 120 more
Caused by: org.alfresco.scripts.ScriptException: 020451608 Failed to execute supplied script: 020451607 TypeError: Cannot set property "destination-folder" of undefined to "org.mozilla.javascript.NativeJavaObject@71a6528f" (AlfrescoJS#8)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:287)
at org.alfresco.repo.processor.ScriptServiceImpl.executeString(ScriptServiceImpl.java:293)
at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:200)
at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:41)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy300.executeScriptString(Unknown Source)
at org.alfresco.repo.workflow.activiti.script.ActivitiScriptBase.executeScript(ActivitiScriptBase.java:112)
at org.alfresco.repo.workflow.activiti.script.ActivitiScriptBase.executeScript(ActivitiScriptBase.java:70)
at org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener.notify(ScriptTaskListener.java:85)
at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.notify(ClassDelegate.java:121)
... 124 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: 020451607 TypeError: Cannot set property "destination-folder" of undefined to "org.mozilla.javascript.NativeJavaObject@71a6528f" (AlfrescoJS#8)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:533)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:283)
... 153 more
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot set property "destination-folder" of undefined to "org.mozilla.javascript.NativeJavaObject@71a6528f" (AlfrescoJS#8)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693)
at org.mozilla.javascript.ScriptRuntime.typeError3(ScriptRuntime.java:3719)
at org.mozilla.javascript.ScriptRuntime.undefWriteError(ScriptRuntime.java:3741)
at org.mozilla.javascript.ScriptRuntime.setObjectElem(ScriptRuntime.java:1559)
at org.mozilla.javascript.gen.AlfrescoJS_13._c_script_0(AlfrescoJS:8)
at org.mozilla.javascript.gen.AlfrescoJS_13.call(AlfrescoJS)
at org.mozilla.javascript.gen.AlfrescoJS_13.exec(AlfrescoJS)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:509)
... 154 more
The area where "destination-folder" is defined:
/* transform to pdf */
var drafts = bpm_package.children[0].parent;
var docroot = drafts.parent;
var dest = docroot.childByNamePath("Released");
var trans = actions.create("transform");
trans.parameters["destination-folder"] = dest;
trans.parameters["assoc-type"] = "{http://www.alfresco.org/model/content/1.0}contains";
trans.parameters["assoc-name"] = String("{http://www.alfresco.org/model/content/1.0}" + bpm_package.children[0].properties["cm:name"]);
trans.parameters["mime-type"] = "application/pdf";
trans.execute(bpm_package.children[0]);
All this should do is move the reviewed document that was converted into a pdf to the folder Release in the same sub directory where Drafts is located. Drafts being the folder where the document originates from to be reviewed.
Are you executing this script in the same context than before?
It seems that this is another error, this time with the instantiation of the transformation action.
var trans = actions.create("transform");
Yes, the context remain the same but I saw the errors differs from the initial error code.
I did remove the initial bpmn file and created a new one from a template in eclipse then proceeded to add the Transform to PDF.
Before I made the new bpmn file I reconfigured some of the paths to check if the fault was there but was unable to find issues there. So I decided to redo the entire workflow and start from scratch. Now the workflow works like it should when the Transform to PDF lines are not added, but the point of this custom workflow is to assign an employee to review the document in Drafts and once approved, the document is transformed into a PDF and and moved to Released in the same sub-folder as Drafts.
Is it possible to see your current bpmn definition?
Yes, off course.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20" id="review-definitions">
<process id="KeystoneDocumentReview" name="Keystone Document Review" isExecutable="true">
<startEvent id="start" activiti:formKey="wf:submitReviewTask"></startEvent>
<sequenceFlow id="flow1" sourceRef="start" targetRef="reviewTask"></sequenceFlow>
<userTask id="reviewTask" name="Review Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:activitiReviewTask">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));]]></activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<sequenceFlow id="flow2" sourceRef="reviewTask" targetRef="reviewDecision"></sequenceFlow>
<exclusiveGateway id="reviewDecision" name="Review Decision"></exclusiveGateway>
<sequenceFlow id="flow3" sourceRef="reviewDecision" targetRef="approved">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" sourceRef="reviewDecision" targetRef="rejected"></sequenceFlow>
<userTask id="approved" name="Document Approved" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:approvedTask">
<documentation>The document was reviewed and approved.</documentation>
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="rejected" name="Document Rejected" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:rejectedTask">
<documentation>The document was reviewed and rejected.</documentation>
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<sequenceFlow id="flow5" sourceRef="approved" targetRef="end"></sequenceFlow>
<sequenceFlow id="flow6" sourceRef="rejected" targetRef="end"></sequenceFlow>
<endEvent id="end"></endEvent>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_activitiReview">
<bpmndi:BPMNPlane bpmnElement="activitiReview" id="BPMNPlane_activitiReview">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="35.0" width="35.0" x="30.0" y="200.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewTask" id="BPMNShape_reviewTask">
<omgdc:Bounds height="55.0" width="105.0" x="105.0" y="190.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">
<omgdc:Bounds height="40.0" width="40.0" x="250.0" y="197.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="approved" id="BPMNShape_approved">
<omgdc:Bounds height="55.0" width="105.0" x="330.0" y="137.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="rejected" id="BPMNShape_rejected">
<omgdc:Bounds height="55.0" width="105.0" x="330.0" y="257.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="35.0" width="35.0" x="620.0" y="147.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="65.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="105.0" y="217.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="210.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="217.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="270.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="270.0" y="164.0"></omgdi:waypoint>
<omgdi:waypoint x="330.0" y="164.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="270.0" y="237.0"></omgdi:waypoint>
<omgdi:waypoint x="270.0" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="330.0" y="284.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="435.0" y="164.0"></omgdi:waypoint>
<omgdi:waypoint x="620.0" y="164.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="435.0" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="637.0" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="637.0" y="182.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
This definition has no transformation logic included. It would be useful to see the definition that generate the new error.
Pardon, I did not realize it was the unmodified file.
The correct file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20" id="review-definitions">
<process id="KeystoneDocumentReview" name="Keystone Document Review" isExecutable="true">
<startEvent id="start" activiti:formKey="wf:submitReviewTask"></startEvent>
<sequenceFlow id="flow1" sourceRef="start" targetRef="reviewTask"></sequenceFlow>
<userTask id="reviewTask" name="Review Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:activitiReviewTask">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));
/* transform to pdf */
var drafts = bpm_package.children[0].parent;
var docroot = drafts.parent;
var dest = docroot.childByNamePath("Released");
var trans = actions.create("transform");
trans.parameters["destination-folder"] = dest;
trans.parameters["assoc-type"] = "{http://www.alfresco.org/model/content/1.0}contains";
trans.parameters["assoc-name"] = String("{http://www.alfresco.org/model/content/1.0}" + bpm_package.children[0].properties["cm:name"]);
trans.parameters["mime-type"] = "application/pdf";
trans.execute(bpm_package.children[0]);]]></activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<sequenceFlow id="flow2" sourceRef="reviewTask" targetRef="reviewDecision"></sequenceFlow>
<exclusiveGateway id="reviewDecision" name="Review Decision"></exclusiveGateway>
<sequenceFlow id="flow3" sourceRef="reviewDecision" targetRef="approved">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" sourceRef="reviewDecision" targetRef="rejected"></sequenceFlow>
<userTask id="approved" name="Document Approved" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:approvedTask">
<documentation>The document was reviewed and approved.</documentation>
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="rejected" name="Document Rejected" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:rejectedTask">
<documentation>The document was reviewed and rejected.</documentation>
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<sequenceFlow id="flow5" sourceRef="approved" targetRef="end"></sequenceFlow>
<sequenceFlow id="flow6" sourceRef="rejected" targetRef="end"></sequenceFlow>
<endEvent id="end"></endEvent>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_activitiReview">
<bpmndi:BPMNPlane bpmnElement="activitiReview" id="BPMNPlane_activitiReview">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="35.0" width="35.0" x="30.0" y="200.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewTask" id="BPMNShape_reviewTask">
<omgdc:Bounds height="55.0" width="105.0" x="105.0" y="190.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">
<omgdc:Bounds height="40.0" width="40.0" x="250.0" y="197.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="approved" id="BPMNShape_approved">
<omgdc:Bounds height="55.0" width="105.0" x="330.0" y="137.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="rejected" id="BPMNShape_rejected">
<omgdc:Bounds height="55.0" width="105.0" x="330.0" y="257.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="35.0" width="35.0" x="620.0" y="147.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="65.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="105.0" y="217.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="210.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="217.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="270.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="270.0" y="164.0"></omgdi:waypoint>
<omgdi:waypoint x="330.0" y="164.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="270.0" y="237.0"></omgdi:waypoint>
<omgdi:waypoint x="270.0" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="330.0" y="284.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="435.0" y="164.0"></omgdi:waypoint>
<omgdi:waypoint x="620.0" y="164.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="435.0" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="637.0" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="637.0" y="182.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
I just deploy this definition and works without any problem.
A pair of considerations:
You must check if the transformed document exist in the drafs space, in other case you would get an error en the transformation process.
You make the document transformation whether you approve it or reject it
Regards.
That is very odd. I reverted to snapshot of alfresco that would be considered a clean installation and deployed the workflow above. I created a new site with only the folders Draft and Released and created a test document in Draft.
I started the workflow for the test document and assigned the task to a non-admin employee. Upon logging in as the employee and completing the workflow by clicking on Approve, I first received a access denied error, I added the employee then to the admin group and was able to resolve that error just to be confronted by another error.
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 02060661 Failed to execute supplied script: 02060660 Content conversion failed:
reader: ContentAccessor[ contentUrl=store://2019/3/6/13/9/767322e5-9b06-4c6e-9a4c-9693cdd9e6d7.bin, mimetype=application/vnd.oasis.opendocument.text, size=0, encoding=UTF-8, locale=en_US]
writer: ContentAccessor[ contentUrl=store://2019/3/6/13/29/ac64d1fa-fbfb-473e-9eac-4965154ff474.bin, mimetype=application/pdf, size=0, encoding=UTF-8, locale=en_US]
options: {use=null, contentReaderNodeRef=workspace://SpacesStore/d52eb780-b083-4904-bbd7-36578c27bdfa, sourceContentProperty={http://www.alfresco.org/model/content/1.0}name, contentWriterNodeRef=workspace://SpacesStore/37a8eb81-1ec0-4d3c-b75a-c6586b7955e9, targetContentProperty={http://www.alfresco.org/model/content/1.0}name, includeEmbedded=null}
limits: {timeoutMs=120000}
Before I continue with the troubleshooting with this issue, could you kindly provide me with the details as to how you went about to deploy the workflow to a document being approved and transformed to pdf then moved to Released.
The steps I followed are as follow:
Created Service-context.xml file with the following configuration in alfresco/extension
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'><beans>
<bean id="extension.workflowBootstrap" parent="workflowDeployer">
<property name="workflowDefinitions">
<list>
<!-- Activiti version of lifecycle process -->
<props>
<prop key="engineId">activiti</prop>
<prop key="location">alfresco/extension/MyProcess3.bpmn</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">true</prop>
</props>
</list>
</property>
</bean></beans>
MyProcess3.bmpn file is created and added to the same directory with the same configuration I posted that you requested.
I open the workflow admin console and proceed to use
deploy activiti alfresco/extension/MyProcess3.bpmn
with out any errors.
After logging in I go to task, start a task with the new workflow, choose the document and assign the reviewer then the workflow starts and the reviewer gets an email notification for the task.
Anything I'm doing wrong in this process?
The deploying method you are using is correct. To asure the transformation only will be done when the document will be appove you could:
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.