Hi All,I am creating Activiti workflow, but i am getting below exception..org.activiti.engine.ActivitiException: Unknown property used in expression
Below code is my process definition file, I am creating a process where initiator start workflow and assign it to one user, that user can assign task to any other user.. this can continue n number of time, until any one rejects the flow, which will end the workflow. So here in approve I am assigning same task to itself.
<?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: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="techWf" name="Tech Specialist Limited Workflow" isExecutable="true">
<!– Start/Initiate Workflow Task –>
<startEvent id="initiateWorkflow" name="Initiate Review" activiti:formKey="tslwf:startTask"></startEvent>
<sequenceFlow id='flow1' sourceRef='initiateWorkflow' targetRef='reviewTaskOne' />
<!– User Review Workflow Task One –>
<userTask id="reviewTaskOne" name="Review Task" activiti:formKey="tslwf:reviewTaskOne">
<extensionElements>
<activiti:taskListener event="create"
class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
task.setVariable("bpm_assignee", "");
if (typeof bpm_workflowDueDate != 'undefined') task.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>
logger.log("—->" + task.getVariable('tslwf_reviewOutcome'));
execution.setVariable('tslwf_reviewOutcome', task.getVariable('tslwf_reviewOutcome'));
logger.log("—-> Variable Assigned " + execution.getVariable('tslwf_reviewOutcome'));
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${bpm_assignee.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id="flow2" targetRef="reviewDecisionOne" sourceRef="reviewTaskOne"></sequenceFlow>
<!– Review Decision –>
<exclusiveGateway id="reviewDecisionOne" name="Review Decision" />
<sequenceFlow id="flow3" sourceRef="reviewDecisionOne" targetRef="reviewTaskOne">
<extensionElements>
<activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
<activiti:field name="script">
<activiti:string>
logger.log("—-> In Sequence Flow " + execution.getVariable('tslwf_reviewOutcome'));
</activiti:string>
</activiti:field>
</activiti:executionListener>
</extensionElements>
<conditionExpression xsi:type="tFormalExpression">${tslwf_reviewOutcome == 'Approve'}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" sourceRef="reviewDecisionOne" targetRef="endFlow" />
<!– End Workflow Task –>
<endEvent id="endFlow" name="End"></endEvent>
</process>
</definitions>
I have enabled server logs, so I am getting below logs
2014-06-08 00:55:19,556 DEBUG [repo.jscript.ScriptLogger] [http-9090-9] —->Approve
2014-06-08 00:55:19,559 DEBUG [repo.jscript.ScriptLogger] [http-9090-9] —-> Variable Assigned Approve
2014-06-08 00:55:19,568 DEBUG [repo.jscript.ScriptLogger] [http-9090-9] —-> In Sequence Flow Approve
2014-06-08 00:55:19,569 DEBUG [repo.jscript.ScriptLogger] [http-9090-9] org.activiti.engine.ActivitiException: Unknown property used in expression
2014-06-08 00:55:19,570 DEBUG [repo.jscript.ScriptLogger] [http-9090-9] Returning 500 status code
Below is my workflow model
<?xml version="1.0" encoding="UTF-8"?>
<model name="tslwf:contentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<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" />
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>
<namespaces>
<namespace uri="http://www.techdemo.com/model/workflow/1.0" prefix="tslwf" />
</namespaces>
<types>
<!– Start Task –>
<type name="tslwf:startTask">
<parent>bpm:startTask</parent>
<mandatory-aspects>
<aspect>bpm:assignee</aspect>
</mandatory-aspects>
</type>
<!– Review Task One –>
<type name="tslwf:reviewTaskOne">
<parent>bpm:activitiOutcomeTask</parent>
<properties>
<property name="tslwf:reviewOutcome">
<type>d:text</type>
<default>Reject</default>
<constraints>
<constraint name="tslwf:reviewOutcomeOptions" type="LIST">
<parameter name="allowedValues">
<list>
<value>Approve</value>
<value>Reject</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.techdemo.com/model/workflow/1.0}reviewOutcome</default>
</property>
</overrides>
<mandatory-aspects>
<aspect>bpm:assignee</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
</aspects>
</model>
Means its coming properly in sequenceFlow and getting value properly using execution.getVariable('tslwf_reviewOutcome'), but in "tFormalExpression", its giving this error, not sure why its not able to find that variable. Let me know if there is other way around to achieve this.Request you to send me your valuable suggestion.Thank you.