cancel
Showing results for 
Search instead for 
Did you mean: 

passing data between task in workflow

kpatel
Confirmed Champ
Confirmed Champ

hi.

I am new in alfresco.I am using alfresco 5.

I want to passing data between task.

i am try to create workflow and model.

please help me to pass data between task.

i want to pass myw:requestTitle to other task.

thank you.

here is my code.

1.workflow-model.xml

<?xml version="1.0" encoding="UTF-8"?>

<model name="myw:workflowModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

    <!-- Optional meta-data about the model -->

    <description>Workflow Model for Repo Extension X</description>

    <author>My Name</author>

    <version>1.0</version>

    <imports>

        <!-- Import Alfresco Dictionary Definitions -->

        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>

        <!-- Import Alfresco Content Domain Model Definitions -->

        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>

        <!-- Import Alfresco Workflow Model Definitions -->

        <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/>

    </imports>

    <!-- Custom namespace for your domain -->

    <namespaces>

        <namespace uri="http://www.mycompany.com/model/workflow/1.0" prefix="myw"/>

    </namespaces>

    <!-- ===============================================================================================================

        Constraints, Types, and Aspects go here...

        -->

        <types>

        <type name="myw:baseReviewTask">

         <parent>bpm:startTask</parent>

         <properties>

    <property name="myw:requestTitle">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

  <property name="myw:medicalLALead">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

  <property name="mywSmiley TongueroductName">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

  <property name="myw:category">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

  <property name="myw:divisionName">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

  <property name="myw:requestType">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

    <property name="mywSmiley TongueroductCode">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

 

    <property name="myw:vendorName">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

 

    <property name="myw:dueDate">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

  <property name="myw:nodeRefForFile">

  <type>d:text</type>

  <mandatory>false</mandatory>

  <multiple>false</multiple>

  <default>none</default>

  </property>

 

    </properties>

       

      </type>

    

      <type name="myw:submitReviewTask">

         <parent>myw:baseReviewTask</parent>

           <mandatory-aspects>

            <aspect>bpm:assignee</aspect>

         </mandatory-aspects>

      </type>

    

      <type name="myw:activitiReviewTask">

            <parent>myw:baseReviewTask</parent>

            <properties>

                <property name="myw:reviewOutcome">

                    <type>d:text</type>

                    <default>Reject</default>

                    <constraints >

                        <constraint name="myw:reviewOutcomeOptions" type="LIST">

                            <parameter name="allowedValues">

                                <list>

                                    <value>Approve</value>

                                    <value>Reject</value>

                                </list>

                            </parameter>

                        </constraint>

                    </constraints>

                </property>

              

            </properties>

            <overrides>

                <property name="bpmSmiley TongueackageItemActionGroup">

                    <default>edit_package_item_actions</default>

                </property>

                <property name="bpmSmiley SurprisedutcomePropertyName">

                    <default>{http://www.alfresco.org/model/workflow/1.0}reviewOutcome</default>

                </property>

            

            </overrides>

        </type>

      

        <type name="myw:approvedTask">

         <parent>myw:baseReviewTask</parent>

      </type>

      <type name="myw:rejectedTask">

         <parent>myw:baseReviewTask</parent>

      </type>

      

      

      </types>

    

</model>

2. xyz-pharma-review.bpmn20.xml

<?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" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://alfresco.org">

  <process id="XYZPharmaiReview" name="XYZ Pharma Review And Approve Activiti Process" isExecutable="true">

    <startEvent id="start" activiti:formKey="myw:submitReviewTask"></startEvent>

    <sequenceFlow id="flow1" sourceRef="start" targetRef="reviewTask"></sequenceFlow>

    <userTask id="reviewTask" name="Review Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="myw: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.dueDate = bpm_workflowDueDate

                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority

                       execution.setVariable('myw_requestTitle', task.getVariable('myw_requestTitle'));

                        ]]></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('myw_reviewOutcome', task.getVariable('myw_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[${myw_reviewOutcome == 'Approve'}]]></conditionExpression>

    </sequenceFlow>

    <sequenceFlow id="flow4" sourceRef="reviewDecision" targetRef="rejected"></sequenceFlow>

    <userTask id="approved" name="Document Approved" activiti:assignee="${initiator.exists() ? initiator.properties.userName : 'admin'}" activiti:formKey="myw: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.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.exists() ? initiator.properties.userName : 'admin'}" activiti:formKey="myw: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.dueDate = bpm_workflowDueDate

                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority

                        execution.setVariable('myw_requestTitle', task.getVariable('myw_requestTitle'))

                        ;]]></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_XYZPharmaiReview">

    <bpmndi:BPMNPlane bpmnElement="XYZPharmaiReview" id="BPMNPlane_XYZPharmaiReview">

      <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="125.0" y="190.0"></omgdc:Bounds>

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">

        <omgdc:Bounds height="40.0" width="40.0" x="290.0" y="197.0"></omgdc:Bounds>

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape bpmnElement="approved" id="BPMNShape_approved">

        <omgdc:Bounds height="55.0" width="105.0" x="390.0" y="97.0"></omgdc:Bounds>

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape bpmnElement="rejected" id="BPMNShape_rejected">

        <omgdc:Bounds height="55.0" width="105.0" x="390.0" y="297.0"></omgdc:Bounds>

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">

        <omgdc:Bounds height="35.0" width="35.0" x="555.0" y="307.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="125.0" y="217.0"></omgdi:waypoint>

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">

        <omgdi:waypoint x="230.0" y="217.0"></omgdi:waypoint>

        <omgdi:waypoint x="290.0" y="217.0"></omgdi:waypoint>

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">

        <omgdi:waypoint x="310.0" y="197.0"></omgdi:waypoint>

        <omgdi:waypoint x="310.0" y="124.0"></omgdi:waypoint>

        <omgdi:waypoint x="390.0" y="124.0"></omgdi:waypoint>

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">

        <omgdi:waypoint x="310.0" y="237.0"></omgdi:waypoint>

        <omgdi:waypoint x="310.0" y="324.0"></omgdi:waypoint>

        <omgdi:waypoint x="390.0" y="324.0"></omgdi:waypoint>

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">

        <omgdi:waypoint x="495.0" y="124.0"></omgdi:waypoint>

        <omgdi:waypoint x="572.0" y="124.0"></omgdi:waypoint>

        <omgdi:waypoint x="572.0" y="307.0"></omgdi:waypoint>

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">

        <omgdi:waypoint x="495.0" y="324.0"></omgdi:waypoint>

        <omgdi:waypoint x="555.0" y="324.0"></omgdi:waypoint>

      </bpmndi:BPMNEdge>

    </bpmndi:BPMNPlane>

  </bpmndi:BPMNDiagram>

</definitions>

1 ACCEPTED ANSWER

jpotts
World-Class Innovator
World-Class Innovator

You need to define the myw:requestTitle property somewhere in your workflow model. Based on where you are trying to retrieve it, I assume you want to set it on the myw:submitReviewTask type. You'll also need to edit the Share configuration so that the new property is shown when someone starts the workflow.

Jeff

View answer in original post

1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator

You need to define the myw:requestTitle property somewhere in your workflow model. Based on where you are trying to retrieve it, I assume you want to set it on the myw:submitReviewTask type. You'll also need to edit the Share configuration so that the new property is shown when someone starts the workflow.

Jeff