cancel
Showing results for 
Search instead for 
Did you mean: 

how to declare activiti property such that it can be shared

jignesh11
Champ in-the-making
Champ in-the-making
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>
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
That's the correct way of doing this, making the value expression use a variable that has been defined earlier by another task…