cancel
Showing results for 
Search instead for 
Did you mean: 

Custom task

ahmetkara
Champ in-the-making
Champ in-the-making
In my project, I need to create a custom task. It is like user task but I need to add a few attributes and persist those attributes. How can I do this??

Thanks…
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
You can use task local variables for this.


public interface TaskService {


  /** get a variables and only search in the task scope.  */
  Object getVariableLocal(String taskId, String variableName);

  /** get a variable on a task */
  Map<String, Object> getVariablesLocal(String taskId, Collection<String> variableNames);



/** set variable on a task.  If the variable is not already existing, it will be created in the
   * task.  */
  void setVariableLocal(String taskId, String variableName, Object value);

  /** set variables on a task.  If the variable is not already existing, it will be created in the
   * task.  */
  void setVariablesLocal(String taskId, Map<String, ? extends Object> variables);

ahmetkara
Champ in-the-making
Champ in-the-making
Hi  Frederik,

Thanks for your reply, I will consider your recommendation but I need something different. For some tasks (they will be service tasks) I will direct them to a class and execute a certain method, so I thought, If I can make it like a special task, other developers will use it with just some parameters, is it possible like this thing?? Also I need to add that new task to modeler palette.

Thankss..

jbarrez
Star Contributor
Star Contributor
Both requirements are supported. You can just implement your own class (implementing JavaDelegate), and pass properties to it.
The Activiti Designer can discover those special tasks, by adding some annotation.

Check the userguide, both are documented in detail there.

ahmetkara
Champ in-the-making
Champ in-the-making
Tnahks Joram