How to set processname dynamically or how to get all variable values of a task?

Hi everyone,

I am modifying our internal inbox application and facing right now the following problem:

In C7 we are using Java classes that implements the TaskListener class. We use this Component for modifing the name of the task (processname) during runtime.

image

public class TaskNameExtender implements TaskListener {
    @Override
    public void notify(DelegateTask delegateTask) {
        ...
        // getting the username from a process variable or from a database
        String username = ...;
        delegateTask.setName("Please approve the vacation request for user " + username);
    }
}

This is required for our inbox to display a name of the task like:
“Please approve the vacation request for user John Doe” and not just “Please approve the vacation request”.

Now we are migrating our processes to C8 and need to modify the processname, again.

In C8 I only have execution listeners for Start and End.

image

Is there a way to realise such a function like above?

An other approach can be that our inbox application gets all open tasks for a user with all process variables.

When I send a POST call against https://{{Region}}.tasklist.camunda.io/{{ClusterId}}/v1/tasks/search I have to add every single variable in the request body:

{
  "includeVariables": [
    {
      "name": "username",
      "alwaysReturnFullValue": true
    }
  ]
}

But I need something like:

{
  "includeAllVariables": true
}

In this case we can set the value for processname to:
“Please approve the vacation request for user ${username}”

And our inbox would replace all ${…} blocks with the process variables and send the final string to the inbox frontend.

I hope someone can help me :slight_smile:

Best regards,

Rainer

1 Like

Hey @Rainer78 - the solution would be using user task listeners. that is currently planned for 8.7; you can follow the epic here: [EPIC] Zeebe Task Listeners · Issue #21974 · camunda/camunda · GitHub

https://{{Region}}.tasklist.camunda.io/{{ClusterId}}/v1/tasks/search* I have to add every single variable in the request body

you can use /v1/tasks/{taskId}/variables/search that can return all variables for a given task

Hi @houssain-barouni,

thank you very much for your answer.

Is it correct, that the “create task listener” is planed for 8.7.0-alpha2 and will be (when the developing is completed) available for C8 installations hosted by you (Camunda), too?

If so, can you tell me, when 8.7.0 will be released?

I will try to use the variables/search command until the release.

Best regards,
Rainer

8.7.0 is planned for January 2025 (normally Jan 14th).
As shown in the epic, the plan is to have the feature ready by alpha2. If it is the case, yes, you will be able to test it in SaaS with an alpha generation.

Great, thank you very much :slight_smile: