This is my first post here, and I'm also new to Activiti (as well as Alfresco), so hopefully this will be a very easy question for you veterans!
I'm using Alfresco Enterprise with Activiti. I'm trying to set up a workflow where a user can initiate a workflow, assign either a single group or multiple individual users (by name), and the workflow will behave accordingly. In essence, I'm trying to combine the Activiti-delivered 'parallel review' and 'pooled review' workflows, with a decision point after the start task to decide which model to follow.
The examples delivered with the product use the Alfresco aspects "bpm:assignees" and "bpm:groupAssignee" to handle the assignments in the start task, but I can't leverage these directly, since I obviously can't set both as mandatory aspects when I want the user to pick one or the other. The problem is, I can't figure out how to test whether either or both of these associations is populated in order to set a flag through the listener. (I would then use that flag to choose a path from the decision point.)
In the sample code below, I'm trying to do this using task.getVariable, but it's not working. (I'm using typeof below; I've also tried this a few different ways.) Is there a different method I need to invoke?
By the way, I realize there are other problems with the code below, but I'm focusing specifically on this problem for now–once the forking is working the way I want it to, I'll flesh out the rest!
<parent>bpm:startTask</parent> <properties> <!– decide how many people have to approve (all) –> <property name="edtrmwf:requiredApprovePercent"> <type>d:int</type> <protected>true</protected> <default>100</default> <constraints> <constraint type="MINMAX"> <parameter name="minValue"><value>1</value></parameter> <parameter name="maxValue"><value>100</value></parameter> </constraint> </constraints> </property> <!– apm decide where task is going –> <property name="edtrmwf:sendToGroup"> <type>d:boolean</type> <default>false</default> <!– apm probably need to add bpm:groupassignee(s) as mandatory aspect –> </property> <property name="edtrmwf:sendToUser"> <type>d:boolean</type> <default>false</default> <!– apm probably need to add bpm:assignees as mandatory aspect –> </property> </properties> <!– apm associations cribbed from bpm:assignees and bpm:groupAssignee in order to avoid making both aspects mandatory –> <associations>
You can always use a custom task-model and NOT use bpm:assignees, but use you're own associations. Make sure the form-config uses the right "control" to render a user/group picker.
ALternative to see if a variable is set is to use task.getVariable('bpm_…') == null in your scripts instead.