Dynamic setting of activity names (service tasks, call activities, receive tasks)?

With the current Flowable design, it looks like we can have dynamic names only for User tasks (and not for others). Also, I can not see any Flowable method API for changing activity names at runtime.

Am I missing something? Is there any way to achieve this?

@martin.grofcik can you help?

Hi Viraj,

Can you precisely describe your use case, please?


I have a use case where I need to set different activity names for different iterations of a multi-instance call activity, for distinguishing purposes. Ideally I would have liked these names to be picked from some key in the collection element variable, or through some process variable. I can do this with user tasks, but not other activity types (call activity, delegates et al.).
For instance, for a multi-instance user task, I could do the following :

<userTask id="miTasks" name="My Task ${loopCounter}" flowable:assignee="${assignee}">
  <multiInstanceLoopCharacteristics isSequential="false">
    <inputDataItem name="assignee" />

I want to achieve this for the other activities as well. For instance, If I have a multi-instance of 3 elements, I would like the call-activity/delegate names to be representative of each iteration. For simplicity purposes, let’s say I want the names to be “some_representative_text ${loopCounter}”.

How can I achieve this, currently?

@martin.grofcik I hope this would suffice. Please let me know if you need more details or clarity.

Call activity name is static. User task creates an expression when it sets user task name. When you use call activity you can create a variable with given dynamic value which can substitute call activity name.
Why do you need dynamic names for the call activities? Do you want to differentiate them in the auditrail?


Yes, differentiating in the audit-trail is one of the major requirements. Not just for call-activities, I want dynamic names for receive-tasks and java-delegates as well.
Let’s say I have a business process, where for multiple clients I have to configure a multi-instance for java-delegate/receive-task/call-activity. This list (for multi-instance) is again dynamic, and would be available only at runtime.
I want each activity to have clear distinguished names for each, which is representative of the client (name should contain a client-associated-variable which will be set during runtime : For example : “receive-task for client-A”, “delegate for client-A”, “call-activity for client-A” and so on.

Currently, I am planning to use execution listeners for solving this, but this has an additional overhead of calling the execution listeners at every start/end of activity, and I feel this is not very optimal.

@martin.grofcik / others, can you think of a better way of solving this?

Hi Viraj,

Execution listener could be one possibility. Another possibility could be to replace tasks behavior when process definition is parsed. Custom task behavior can do anything with the task name.
When I think about it resolving name expression by default (e.g. as a part of the product) could affect performance.