10-20-2015 04:29 PM
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 09200041 Failed to execute supplied script: 09200040 ReferenceError: "adwf_approveCount" n'est pas défini (AlfrescoJS#2)
org.activiti.engine.ActivitiException: Unknown property used in expression: ${adwf_approveCount < 2}
<?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" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="StrategyReview" name="Strategy Document Review" isExecutable="true">
<startEvent id="startevent1" name="Start" activiti:formKey="adwf:submitReviewTask"></startEvent>
<scriptTask id="submit" name="submit" scriptFormat="javascript" activiti:autoStoreVariables="false">
<script><![CDATA[var adwf_approveCount = 0;]]></script>
</scriptTask>
<parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway>
<userTask id="strategyReview" name="Strategy Review" activiti:candidateGroups="GROUP_Strategy" activiti:formKey="adwf:activitistrategyReview">
<extensionElements>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if(task.getVariableLocal('adwf_approveRejectOutcome') == 'Approve') {
var newApprovedCount = adwf_approveCount + 1;
execution.setVariable('adwf_approveCount', newApprovedCount);
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="financeReview" name="Finance Review" activiti:candidateGroups="GROUP_Finance" activiti:formKey="adwf:activitifinanceReview">
<extensionElements>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if(task.getVariableLocal('adwf_approveRejectOutcome') == 'Approve') {
var newApprovedCount = adwf_approveCount + 1;
execution.setVariable('adwf_approveCount', newApprovedCount);
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="revise" name="Revise" activiti:assignee="${initiator.properties.userName}" activiti:formKey="adwf:activitiRevise">
<extensionElements>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>if(task.getVariableLocal('adwf_reviseOutcome') == 'Re-submit') {
execution.setVariable('adwf_resubmit', true);
} else {
execution.setVariable('adwf_resubmit', false);
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<parallelGateway id="parallelgateway2" name="Parallel Gateway"></parallelGateway>
<userTask id="directorReview" name="Director Review" activiti:candidateGroups="GROUP_Directors" activiti:formKey="adwf:activitidirectorReview">
<extensionElements>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if(task.getVariableLocal('adwf_approveRejectOutcome') == 'Approve') {
var newApprovedCount = adwf_approveCount + 1;
execution.setVariable('adwf_approveCount', newApprovedCount);
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
<userTask id="ApprovedNotification" name="Approved Notification" activiti:assignee="${initiator.properties.userName}" activiti:formKey="adwf:activitiApprovedNotification"></userTask>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="startFlow" sourceRef="startevent1" targetRef="submit"></sequenceFlow>
<sequenceFlow id="submitFlow" sourceRef="submit" targetRef="parallelgateway1"></sequenceFlow>
<sequenceFlow id="strategyInputFlow" sourceRef="parallelgateway1" targetRef="strategyReview"></sequenceFlow>
<sequenceFlow id="financeInputFlow" sourceRef="parallelgateway1" targetRef="financeReview"></sequenceFlow>
<sequenceFlow id="strategyOutputFlow" sourceRef="strategyReview" targetRef="parallelgateway2"></sequenceFlow>
<sequenceFlow id="financeOutputFlow" sourceRef="financeReview" targetRef="parallelgateway2"></sequenceFlow>
<sequenceFlow id="firstDecisionFlow" sourceRef="parallelgateway2" targetRef="exclusivegateway1"></sequenceFlow>
<sequenceFlow id="firstReviseFlow" sourceRef="exclusivegateway1" targetRef="revise">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${adwf_approveCount < 2}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="directorInputFlow" sourceRef="exclusivegateway1" targetRef="directorReview">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${adwf_approveCount == 2}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="directorOutputFlow" sourceRef="directorReview" targetRef="exclusivegateway2"></sequenceFlow>
<sequenceFlow id="approveFlow" sourceRef="exclusivegateway2" targetRef="ApprovedNotification">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${adwf_approveCount == 3}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="secReviseFlow" sourceRef="exclusivegateway2" targetRef="revise">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${adwf_approveCount < 3}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="endFlow" sourceRef="ApprovedNotification" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="resubmitFlow" sourceRef="revise" targetRef="submit">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${adwf_resubmit == true}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="abortReviseFlow" sourceRef="revise" targetRef="endevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${adwf_resubmit == false}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_StrategyReview">
<bpmndi:BPMNPlane bpmnElement="StrategyReview" id="BPMNPlane_StrategyReview">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="10.0" y="180.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="submit" id="BPMNShape_submit">
<omgdc:Bounds height="55.0" width="105.0" x="80.0" y="170.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="parallelgateway1" id="BPMNShape_parallelgateway1">
<omgdc:Bounds height="40.0" width="40.0" x="220.0" y="177.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="strategyReview" id="BPMNShape_strategyReview">
<omgdc:Bounds height="55.0" width="105.0" x="280.0" y="116.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="financeReview" id="BPMNShape_financeReview">
<omgdc:Bounds height="55.0" width="105.0" x="280.0" y="217.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="revise" id="BPMNShape_revise">
<omgdc:Bounds height="55.0" width="105.0" x="280.0" y="310.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="parallelgateway2" id="BPMNShape_parallelgateway2">
<omgdc:Bounds height="40.0" width="40.0" x="400.0" y="177.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="directorReview" id="BPMNShape_directorReview">
<omgdc:Bounds height="55.0" width="105.0" x="550.0" y="170.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
<omgdc:Bounds height="40.0" width="40.0" x="480.0" y="177.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
<omgdc:Bounds height="40.0" width="40.0" x="680.0" y="177.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ApprovedNotification" id="BPMNShape_ApprovedNotification">
<omgdc:Bounds height="55.0" width="105.0" x="740.0" y="170.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="910.0" y="180.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="startFlow" id="BPMNEdge_startFlow">
<omgdi:waypoint x="45.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="80.0" y="197.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="submitFlow" id="BPMNEdge_submitFlow">
<omgdi:waypoint x="185.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="220.0" y="197.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="strategyInputFlow" id="BPMNEdge_strategyInputFlow">
<omgdi:waypoint x="240.0" y="177.0"></omgdi:waypoint>
<omgdi:waypoint x="240.0" y="143.0"></omgdi:waypoint>
<omgdi:waypoint x="280.0" y="143.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="financeInputFlow" id="BPMNEdge_financeInputFlow">
<omgdi:waypoint x="240.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="240.0" y="244.0"></omgdi:waypoint>
<omgdi:waypoint x="280.0" y="244.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="strategyOutputFlow" id="BPMNEdge_strategyOutputFlow">
<omgdi:waypoint x="385.0" y="143.0"></omgdi:waypoint>
<omgdi:waypoint x="420.0" y="143.0"></omgdi:waypoint>
<omgdi:waypoint x="420.0" y="177.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="financeOutputFlow" id="BPMNEdge_financeOutputFlow">
<omgdi:waypoint x="385.0" y="244.0"></omgdi:waypoint>
<omgdi:waypoint x="420.0" y="244.0"></omgdi:waypoint>
<omgdi:waypoint x="420.0" y="217.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="firstDecisionFlow" id="BPMNEdge_firstDecisionFlow">
<omgdi:waypoint x="440.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="480.0" y="197.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="firstReviseFlow" id="BPMNEdge_firstReviseFlow">
<omgdi:waypoint x="500.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="483.0" y="337.0"></omgdi:waypoint>
<omgdi:waypoint x="385.0" y="337.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="directorInputFlow" id="BPMNEdge_directorInputFlow">
<omgdi:waypoint x="520.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="550.0" y="197.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="directorOutputFlow" id="BPMNEdge_directorOutputFlow">
<omgdi:waypoint x="655.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="680.0" y="197.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="approveFlow" id="BPMNEdge_approveFlow">
<omgdi:waypoint x="720.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="740.0" y="197.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="secReviseFlow" id="BPMNEdge_secReviseFlow">
<omgdi:waypoint x="700.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="430.0" y="443.0"></omgdi:waypoint>
<omgdi:waypoint x="332.0" y="365.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="endFlow" id="BPMNEdge_endFlow">
<omgdi:waypoint x="845.0" y="197.0"></omgdi:waypoint>
<omgdi:waypoint x="910.0" y="197.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="resubmitFlow" id="BPMNEdge_resubmitFlow">
<omgdi:waypoint x="280.0" y="337.0"></omgdi:waypoint>
<omgdi:waypoint x="132.0" y="337.0"></omgdi:waypoint>
<omgdi:waypoint x="132.0" y="225.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="abortReviseFlow" id="BPMNEdge_abortReviseFlow">
<omgdi:waypoint x="332.0" y="365.0"></omgdi:waypoint>
<omgdi:waypoint x="692.0" y="401.0"></omgdi:waypoint>
<omgdi:waypoint x="927.0" y="215.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="adwf:workflowmodel"
xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>AD Workflow Demo</description>
<author>Driss Chelouati</author>
<version>1.0</version>
<!– Imports are required to allow references to definitions in other models –>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0"
prefix="d" />
<import uri="http://www.alfresco.org/model/bpm/1.0"
prefix="bpm" />
</imports>
<!– Introduction of new namespaces defined by this model –>
<namespaces>
<namespace uri="http://www.ad.com/model/workflow/1.0"
prefix="adwf" />
</namespaces>
<types>
<type name="adwf:submitReviewTask">
<parent>bpm:startTask</parent>
</type>
<type name="adwf:activitistrategyReview">
<parent>adwf:activitiReviewTask</parent>
</type>
<type name="adwf:activitifinanceReview">
<parent>adwf:activitiReviewTask</parent>
</type>
<type name="adwf:activitidirectorReview">
<parent>adwf:activitiReviewTask</parent>
</type>
<type name="adwf:activitirevise">
<parent>bpm:activitiOutcomeTask</parent>
<properties>
<property name="adwf:reviseOutcome">
<type>d:text</type>
<default>Abort</default>
<constraints>
<constraint type="LIST">
<parameter name="allowedValues">
<list>
<value>Re-submit</value>
<value>Abort</value>
</list>
</parameter>
</constraint>
</constraints>
</property>
</properties>
<overrides>
<property name="bpm:packageItemActionGroup">
<default>edit_package_item_actions</default>
</property>
<property name="bpm:outcomePropertyName">
<default>{http://www.ad.com/model/workflow/1.0}reviseOutcome</default>
</property>
</overrides>
</type>
<type name="adwf:activitiReviewTask">
<parent>bpm:activitiOutcomeTask</parent>
<properties>
<property name="adwf:approveRejectOutcome">
<type>d:text</type>
<default>Reject</default>
<constraints>
<constraint type="LIST">
<parameter name="allowedValues">
<list>
<value>Approve</value>
<value>Reject</value>
</list>
</parameter>
</constraint>
</constraints>
</property>
</properties>
<overrides>
<property name="bpm:packageItemActionGroup">
<default>read_package_item_actions</default>
</property>
<property name="bpm:outcomePropertyName">
<default>{http://www.ad.com/model/workflow/1.0}approveRejectOutcome</default>
</property>
</overrides>
</type>
<type name="adwf:activitiApprovedNotification">
<parent>bpm:workflowTask</parent>
<overrides>
<property name="bpm:packageItemActionGroup">
<default>read_package_item_actions</default>
</property>
</overrides>
</type>
</types>
</model>
10-23-2015 10:26 AM
org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate
Java class.
<scriptTask id="scripttask1" name="Submit" scriptFormat="javascript" activiti:autoStoreVariables="true">
<script>execution.setVariable('scwf_approveCount', 0); execution.setVariable('scwf_tpApproved', false);</script>
</scriptTask>
<serviceTask id="scripttask1" name="Submit" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
<extensionElements>
<activiti:field name="runAs">
<activiti:string><![CDATA[admin]]></activiti:string>
</activiti:field>
<activiti:field name="script">
<activiti:string><![CDATA[
execution.setVariable('scwf_approveCount', 0);
execution.setVariable('scwf_tpApproved', false);
]]></activiti:string>
</activiti:field>
</extensionElements>
</serviceTask>
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.