I want to know how to change user task name in tasklist.
This is my flow:
step1: Get message from Message queue(rabbitmq).
step2: Start camunda flow by api(http://localhost:8080/engine-rest/process-definition/key/issue-listener/submit-form)
step3: The flow has a user task called “usertask”
step4: user go to tasklist and complete the task.
My problem is:
My java application will call this flow many times at same time. So there are many tasks in the tasklist and all the task name are “usertask”. I want to change “usertask” to different names. For examples, can I send a process variable as task name when I start the flow by api. So every time I will have a new task name and the name in the tasklist will be different.
Btw.: If it is for single tasks only, it could be modeled right into the bpmn adding a script.
Just add a task listener to the specific user task. Event Type: create,Listener Type: Script, Script Format e.g. “javascript”, Script Type: Inline script and add a single line like: task.name = "Attention: " + userInput;
where “userInput” contains the dynamic part
Hi, i’m looking to implement something similar to what is posted in this thread.
Basically I want to have a task with a dynamic name. A fix part + A dynamic part (coming from one processVariable).
I’m thinking of implementing a task listener script (javascript) but it doesn’t seem to work.
This is my script:
task.name = "This is a dynamic task name: " + target;
A couple of doubts:
Should we call the variable “target” or execution.getVariable(“target”) ?
What should we enter in the name of the task? Whatever we put here will it be automatically replaced by the task listener or should this be empty?
Hi @Ingo_Richtsmeier thanks for your reply. I tried a few times but with no luck. Does this apply to Manual tasks as well?
Here is a screenshot of a dummy model I have to test this.
The goal is to modify the name of the manual task based on the input variable “var”.
E.g. if var=Matias, then the manual task should be named: “My manual task is called Matias”
When i star the process i get the following error msg. Any ideas what i’m doing wrong?
Thanks!
"message": "Cannot instantiate process definition Dynamic_task_name:5:f3928d7b-7555-11eb-8995-0242ac110002: Unable to evaluate script while executing activity 'Task_0t2okuc' in the process definition with id 'Dynamic_task_name:5:f3928d7b-7555-11eb-8995-0242ac110002':<eval>:1:24 Expected an operand but found var\ntask.name = task.name + var;\n ^ in <eval> at line number 1 at column number 24"