AnsweredAssumed Answered

How to add TaskListeer to user task using UserTask class?

Question asked by kalanavweerarathna on Nov 9, 2018

Is there any example doc for Add TaskListener to UserTask..? (Java Base, Using BpmnModel Class)

This is my code and it has run time errors

 

SyntaxEditor Code Snippet

UserTask userTask = new UserTask(); 
ActivitiListener activitiListener = new ActivitiListener(); 
activitiListener.setEvent( TaskListener.EVENTNAME_COMPLETE );
activitiListener.setImplementation( ImplementationType.IMPLEMENTATION_TYPE_CLASS );
activitiListener.setImplementation( "<my_package>.TestTaskListener" ); 
userTask.getTaskListeners().add( activitiListener );

And Error
org.activiti.engine.ActivitiException: Errors while parsing:
[Validation set: 'activiti-executable-process' | Problem: 'activiti-usertask-listener-implementation-missing'] : Element 'class' or 'expression' is mandatory on executionListener - [Extra info : processDefinitionId = my-process | processDefinitionName = my dynamic process | | id = task1 | | activityName = First task | ] ( line: 6, column: 74)

 

Thanks in Advance

Outcomes