Okay then. Thanks for your clear explanation.
Best,
Ashlah
Okay then. Thanks for your clear explanation.
Best,
Ashlah
Hi, is there any rest api endpoint for setting a variable at activity scope?
hi. Does this still work?
I am updating a variable in my sub process scope like this:
http://localhost:8080/engine-rest/execution/Task_09wzlbx:5467d99f-bbca-11e8-a5b2-ace2d3a04152#multiInstanceBody/localVariables/caseObject
PUT request
with variable:
{“value” : “someValue”, “type”: “String”}
but it gives me 405 (method not allowed )
Hi @Urvashi_Prasad,
Task_09wzlbx:5467d99f-bbca-11e8-a5b2-ace2d3a04152#multiInstanceBody
is not an execute id but an activity instance id, so this request will not work anyway. On top of that, I guess the #
symbol also messes up the URL unless you encode it properly.
Cheers,
Thorben
Hi @thorben Can you please tell me a way to add/update a variable on a subprocess scope using REST API?
I have been trying for a while now.
I have posted what all i have tried in this topic.
Thanks
Can anyone please let me know if this feature
https://docs.camunda.org/manual/7.7/user-guide/process-engine/variables/#setting-variables-to-specific-scope
is available through REST API or not.?
Hi Urvashi,
I faced the same scenario where I had to save a variable’s value at a specific scope using REST API,
This is what I found
execution.setVariable("testVar",execution.getVariable("testVar"),execution.getCurrentActivity().getId());
OR
execution.setVariableLocal("testVar", execution.getVariable(“testVar”));
Thanks for your response Udit. I ended up doing a similar thing.
Added a process instance variable through rest api, and then use that to post it to sub-process scope.
works for now.
@thorben, I am not sure how #multiInstanceBody
should be used. Let’s use the diagram you posted in this diagram. suppose I am in Task (task id = 100) now, and I want to create a variable which can be accessed in the Subprocess(parallel mulit instance) scope. Is it right that the code be like:
execution.setVariable(‘a’, ‘some value’, ‘100#multiInstanceBody’);
I tried this code, but it’s not correct, complaining scope not found.
Hi @liang,
The third parameter must have the following format: <activity ID in BPMN XML>#multiInstanceBody
. So let’s say the ID of the activity named Task is task
, then the parameter value should be task#multiInstanceBody
.
Does that make sense?
Cheers,
Thorben
@thorben, thanks for your response. that makes sense, and it’s my understanding too.
In the Task:
var activityId = execution.getCurrentActivityId()+’#multiInstanceBody’;
execution.setVariable(‘insId’, ‘some value’, activityId);
In above code I will get an error complaining scope not found.
Hi @liang,
Please share a unit test on github reproducing this and I can take a look.
Cheers,
Thorben