I am attempting to set a dynamic name (from variables) on a task in both English and French. Setting it to english is working fine:
<userTask id="sid-20F0CE . . ." name="${requestTypeName}">
</userTask>
When trying to use the localization tag and a variable, I discovered that the variables do not get evaluated within this tag. Another post on this forum confirmed this:
<extensionElements>
<flowable:localization locale="fr" name="${requestTypeName_FR}" />
</extensionElements>
I then removed the above tag and tried setting the localized name on the task object.
Task task = taskService.createTaskQuery().taskId(taskId).locale("fr").singleResult();
task.setLocalizedName("Nom Francais");
taskService.saveTask(task);
This appears to change the actual name of the task and not the localized name. Retrieving that task in both English and French now returns the value “Nom Francais”. The schema of the database does not appear to support the ability to store names in multiple languages. I am unsure what setLocalizedName does as opposed to setName.
I was able to trace through the code and noticed that the localized values are read in from the DefaultTaskLocalizationManager class. This is where the values get read from the process definition localization nodes.
I also looked into the DynamicBmpnService, more specifically the changeLocalizationName methods. Again, the problem is that this service deals with the process definition and not the process instance.
I am looking for the ability to dynamically set the task name, in multiple languages, on a per process instance level based on variables and not rely on static values from the process definition. The only solution I can think of is to implement my own DefaultTaskLocalizationManager and do the variable evaluation when reading the localization node. Not quite sure how I would do this.
If anyone has done something similar or has some ideas, please send them my way.
Stephane