AnsweredAssumed Answered

Event never thrown when task assigned in user code.

Question asked by rosselet on Dec 16, 2015
Latest reply on Dec 16, 2015 by rosselet
in TaskEntity.java I see this @ line 547

    // if there is no command context, then it means that the user is calling the
    // setAssignee outside a service method.  E.g. while creating a new task.
    if (commandContext!=null) {
      commandContext
        .getHistoryManager()
        .recordTaskAssigneeChange(id, assignee);
     
      if (assignee != null && processInstanceId != null) {
        getProcessInstance().involveUser(assignee, IdentityLinkType.PARTICIPANT);
      }
    
      if(!StringUtils.equals(initialAssignee, assignee)) {
         fireEvent(TaskListener.EVENTNAME_ASSIGNMENT);
         initialAssignee = assignee;
      }

this means that assignment events never thrown when assignment happens in user code?  Why not - what is the logic behind this?  I would like to have a manager to set the assignee for a task when the task is unassigned, and for an ASSIGNMENT event to be thrown in the same manner as a COMPLETE event is thrown if I call complete on a task from my code.   Is it possible that the involveuser/throw here could/should be moved to outside the commandContext check?  Or is there a way to set the commandContext from our code?
Cheers
Ati

Outcomes