cancel
Showing results for 
Search instead for 
Did you mean: 

candidateGroup null not accepted.

shiva_arunachal
Champ in-the-making
Champ in-the-making
I have an application with a user task,

<userTask id="usertask1" name="User Task" activiti:assignee="${assigneeName}" activiti:candidateGroups="${candidateGroup}">

My scenario is that from my UI, i will enter either assigneeName (or) candidateGroup but not both. If i enter candidate group and leave assignee name null, it works fine. But if assignee name is entered and candidateGroup is left null, i get exception shown below.
Please assist.

<blockcode>
org.activiti.engine.ActivitiIllegalArgumentException: Expression did not resolve to a string or collection of strings
   at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.handleAssignments(UserTaskActivityBehavior.java:179)
</blockcode>
2 REPLIES 2

shiva_arunachal
Champ in-the-making
Champ in-the-making
In<code> UserTaskActivityBehavior.java</code> assigneeValue  is initialized to null because of which it works fine. Similarly why is null value not allowed for groupId ? why is exception thrown if value is null?
<blockcode>
  if (taskDefinition.getAssigneeExpression() != null) {
      Object assigneeExpressionValue = taskDefinition.getAssigneeExpression().getValue(execution);

String assigneeValue = null;

      if (assigneeExpressionValue != null) {
        assigneeValue = assigneeExpressionValue.toString();
      }
      task.setAssignee(assigneeValue, true, false);
    }
    </blockcode>

    <blockcode>
if (!taskDefinition.getCandidateGroupIdExpressions().isEmpty()) {
      for (Expression groupIdExpr : taskDefinition.getCandidateGroupIdExpressions()) {
        Object value = groupIdExpr.getValue(execution);
        if (value instanceof String) {
          List<String> candidates = extractCandidates((String) value);
          task.addCandidateGroups(candidates);
        } else if (value instanceof Collection) {
          task.addCandidateGroups((Collection) value);
        } else {

//why is exception thrown here? can't the "value" be null?
throw new ActivitiIllegalArgumentException("Expression did not resolve to a string or collection of strings");  // line num:179

        }
      }
    }    </blockcode>

jbarrez
Star Contributor
Star Contributor
when you use the candidateGroup="" in the xml, it expects that something is filled in. When a task is assigned to someone, the group cannot pick it anymore. Set the assignee to null to 'give it back to the group'