AnsweredAssumed Answered

IdentityLink and execution listener

Question asked by zze_one on Jun 10, 2014
Latest reply on Jun 10, 2014 by zze_one
Hi everyone.

I'm really looking forward for some help on how to set involved users and groups. Thanks in advance.

I'm adding an execution listener to a user task.


<userTask id="usertask1" name="First User Task">
      <extensionElements>
         <activiti:executionListener class="realfoundation.foundationservices.process.tasks.FoundationTaskListener" event="start">
            <activiti:field name="involvedGroups" expression="${organizers}" />
         </activiti:executionListener>
       </extensionElements>
    </userTask>


Thanks to this execution listener and to field injection, I'm able to catch the involved users I'd like to set on the task instance.

public class FoundationTaskListener implements ExecutionListener {

    private Expression involvedGroups;

    @Override
    public void notify(DelegateExecution paramDelegateExecution) throws Exception {

        if (involvedGroups != null) {
            for (String group : transformInvolvedActorsToList(involvedGroups.getValue(paramDelegateExecution).toString())) {
                paramDelegateExecution.setVariable("involvedPeps", involvedGroups.getValue(paramDelegateExecution).toString());
            }
        }
    }
}


How to add those involved users as IdentityLink ?
As the execution listener's event is set to start, the task instance is not yet instantiated.

Thanks again.

Outcomes