Hello,
I have the process variable whose value is a Java object.
Let’s say the variable name is request
, the Java class of the value object is com.blah.blah.Request
and the class has the Boolean
member named valid
(with its getter and setter of course).
Now I want that user task updates the value of this valid
member of the request
variable.
How can I do this?
I tried the endpoint POST /task/{id}/complete
, but most natural notation (in my opinion ) for the variable name in the endpoint payload request.valid
doesn’t work. The new process variable with the name request.valid
is created, but the valid
member of the request
variable is not updated.
Please advise.
Thanks,
Yuriy
Hi Yuriy,
You cannot simply set a single member of an object.
I would add input and output-mappings to the user task. There you can use an expression, to extract the single member into a variable and to set a single member based on a variable. The variables are only available locally (i.e., in that specific task):
I hope this helps.
Stephan
1 Like
Hi Stephan,
But I can use this notation on the flows that come out from xor gateway. I already have it in my bpm - the conditions are is ${request.valid == "TRUE"}
and ${request.valid != "TRUE"}
. And such access works for quite deeply nested class members on the forking flows.
Anyway, I’ve found quick and dirty solution - the task writes the value to the dedicated primitive var and the task has dedicated “complete” event listener with java implementation. Inside Java I can do anything. May be ugly, but it works.
Thanks and regards,
Yuriy
1 Like
Hi Yuriy,
The difference lies between accessing a variable (you can access a deeply nested object, i.e., in an expression) and setting on of its members via the API. You need to provide the full object in the API call.
Glad that you found a solution that works for you. However, variable mappings should work just as well, without implementing an additional delegate