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

**URL:** <https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172>\
**Category:** Flowable Engine\
**Created:** [July 12, 2019, 1:16pm UTC](https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172 "2019-07-12T13:16:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![virajbajoria](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@virajbajoria](https://forum.flowable.org/u/virajbajoria)\
**Post date:** [July 12, 2019, 1:16pm UTC](https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172/1 "2019-07-12T13:16:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [July 15, 2019, 8:44am UTC](https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172/2 "2019-07-15T08:44:33Z")

</div>

Hi Viraj,

Can you precisely describe your use case, please?

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![virajbajoria](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@virajbajoria](https://forum.flowable.org/u/virajbajoria)\
**Post date:** [July 15, 2019, 9:22am UTC](https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172/3 "2019-07-15T09:22:07Z")

</div>

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 :

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

```

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.

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [July 15, 2019, 11:02am UTC](https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172/4 "2019-07-15T11:02:53Z")

</div>

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?

Martin

---

<div class="post-metadata">

**Author:** ![virajbajoria](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@virajbajoria](https://forum.flowable.org/u/virajbajoria)\
**Post date:** [July 15, 2019, 9:40pm UTC](https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172/5 "2019-07-15T21:40:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [July 16, 2019, 11:27am UTC](https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172/6 "2019-07-16T11:27:49Z")

</div>

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.

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![mmarekk11](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@mmarekk11](https://forum.flowable.org/u/mmarekk11)\
**Post date:** [September 27, 2023, 2:08pm UTC](https://forum.flowable.org/t/dynamic-setting-of-activity-names-service-tasks-call-activities-receive-tasks/4172/7 "2023-09-27T14:08:15Z")

</div>

Hello,  
I am opening this old topic, because this is exactly what I need to achieve.

@martin.grofcik (or anybody else) could you please describe in more detail how can I change the name of userTask in a way as virajbajoria requested?  
In previous post you mentioned 2 ways:

1. Listeners (I tried but unsuccessfully)
2. Replace tasks behavior when process definition is parsed (no idea how to do this)

Thanks a lot.
