Hello to all! I have a question, is there a way to bind some constant variables to a user task in the camunda modeler? In my process, there are some user tasks that require the user to watch a youtube video and it would be ideal for me to store the URL directly in the task, so I can retrieve it through RestAPI call and pass it to my frontend. I have searched through camunda docs and in this forum but I wasn’t able to find an answer. Should I just declare some form variables and retrieve them as such? Are there other ways to implement such idea?
You could do that by using a input variable as part of the task - or you could create a task listener that generates the variable as the task is created.
I tried to define in the Modeler a Form variable but it binds it to the process instance, I would like to define this variable and retrieve it with the task’s variable API. I don’t know, though, how to instantiate such variables through the modeler, if possible of course.
Thank you very much! Can I ask you also if these variables are accessible also when the task is completed? Or are they active only during its execution?
I tried implementing it, it solved the problem but it gave me another one. I think I didn’t explain my case well and I apologise.
As you can see, I have four concurrent user tasks, each of them correspond to a youtube video that needs to be watched by the user. By putting the listener, I imagined it was a variable for each task, instead it sets a unique variable, binding it to the process-instance rather than the task itself.
Is there a way I can bind a variable to a single task?
I’m really sorry that I did not make it more clear earlier.
Looked around on the Camunda Variable page and read about the local variables. I’m really sorry I wasted your time guys, I just needed to change execution.setVariable(...) to execution.setVariableLocal(...). Anyways, you gave me the right advice. Thank you very much again!