where {taskId} and {processId} are set through expressions inside the Camunda Modeler, and taken form process variables (process ID is an external ID from our database that we set in the Camunda process when starting it).
I want to be able to set the {taskId} dynamically for each task generated, I already have this task id when querying the Get Tasks REST method, as the “id” variable, but I am unable to set this id as part of the formKey through Camunda Modeler.
Is it possible to create a listener or input/output combination to take the Task ID from the process instance (not the Task Id in the modeler definition) that assigns the task Id to the Form Key for each unique task instance?
Currently it arrives like this, since the taskId variable is empty
/process//4152/taskType
While possible to set the taskId variable to something like “placeholder” and then in the external task list do a find and replace of the placeholder for the task id, it would be ideal to be able to generate the formKey with the full URL inside the Camunda process so that any time the API is called we have the URL available without needing extra steps outside of Camunda itself.
If I’m understanding this correctly it means that I can set a Task Listener as event type create with a script such as
execution.setVariable(‘taskId’, task.id);
And I could reference that task.id
I think I am going in the right direction, I have been able to set the ${taskId} variable in the formKey through the Input/Output parameters as such:
Obviously this sets it to “task.id” and not the actual Task Id, I have tried to use task.id, task.getId() and delegateTask.getId() but all are incorrect, as I get a “no such property exists” error
Cannot instantiate process definition Process_0d59h8j:97:4f00dcfa-2756-11ec-9c92-0a93d3b15900: Unable to evaluate script: groovy.lang.MissingPropertyException: No such property: task for class: Script74
Possible solutions: class [ start-instance-error ]
Thanks again for the reply @Ingo_Richtsmeier I’m sure I’m just missing something very obvious here.
My issue is that I can’t figure out how to assign the value to the variable, whether through a Listener or an Input mapping using delegateTask.getId() as the value to assign to the variable returns that there is no property for the class.
For example, using a Listener of Event Type create
Cannot instantiate process definition Process_0d59h8j:135:b3e5b011-2764-11ec-9c92-0a93d3b15900: ENGINE-03051 There was an exception while invoking the TaskListener. Message: ‘Unable to evaluate script while executing activity ‘Activity_08rbaai’ in the process definition with id ‘Process_0d59h8j:135:b3e5b011-2764-11ec-9c92-0a93d3b15900’: groovy.lang.MissingPropertyException: No such property: execution for class: Script95’ [ start-instance-error ]
Is this because I am trying to call something that’s out of scope? Or is this a configuration issue on my end?