'How to set activiti task name dynamically?

I need to set task name dynamically for activiti 7, just like below snippt code:

  <userTask id='theTask' name='${taskNameDynamically}' >
    ...
  </userTask>

I've search for this problem, but still cannot find any workaround yet



Solution 1:[1]

You can use DelegateTask to set task name dynamically, with method: setName

example:

    @Component("CustomTaskListener")
    public class CustomTaskListener implements TaskListener {
    
        @Override
        public void notify(DelegateTask task) {
                        
            task.setName("newTaskName");
        }
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 3omar