AnsweredAssumed Answered

how to declare activiti property such that it can be shared

Question asked by jignesh11 on Apr 3, 2013
Latest reply on Apr 3, 2013 by frederikheremans1
Hi I want to declare property in such a way that it's value can be shared between two different tasks.
In below example user task 1 will set value of sessionYear, code and organisation. I want to use those values in usertask2 (not as form property).

I call Activiti Rest API from my application. to get task form properties I call GET form/{taskId}/properties.

When i call this for task 2 it gives me only 'changeRegulations' property. but how can i get task 1 properties and it's value in usertask 2?

The one in red color is my solution: declare sessionYear again in task 2 and assign value using ${sessionYear}

Is this the correct way to do it? or are there any other better options?

 <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="Notify Contact" activiti:assignee="kermit" activiti:formKey="notifycontact">
      <extensionElements>
        <activiti:formProperty id="sessionYear" name="sessionYear" type="string" required="true"></activiti:formProperty>
        <activiti:formProperty id="code" name="code" type="string" required="true"></activiti:formProperty>
        <activiti:formProperty id="organisation" name="organisation" type="string" required="true"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <userTask id="usertask2" name="Review Code" activiti:assignee="kermit">
      <documentation>If needed, You are advised to amend code ${code} for session year ${sessionYear}.</documentation>
      <extensionElements>
[color=#FF0000]<activiti:formProperty id="sessionYear" name="sessionYear" type="string" required="true">${sessionYear}</activiti:formProperty>[/color]
        <activiti:formProperty id="changeRegulations" name="Do you want to change this code " type="enum" required="true">
          <activiti:value id="true" name="Yes"></activiti:value>
          <activiti:value id="false" name="No"></activiti:value>
        </activiti:formProperty>
      </extensionElements>
    </userTask>

Outcomes