Hello,
I am using camunda 7.19. I’ve created small BPMN which has a process variable listValue
I would like to use js to modify the values of the list
the script is
function getNumber(){
var number = execution.getVariable('number')
print("found number " + number);
var listValues = execution.getVariable('listValues');
for (var i=0; i<listValues.length; i++)
print(i + ". " + listValues[i]);
const newList = [];
execution.setVariable('listValues', newList);
}
getNumber()
I’ve added GraalVM Js to use this in the tests
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>21.1.0</version>
</dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>21.1.0</version>
</dependency>
the js script is called and I am able to read the values but the setVariable
fails with Cannot find serializer for value 'Untyped value '[]', isTransient = false'.
I have checked and listValues
is an array (with Array.isArray
) but it doesn’t have the methods I would expect from an array (e.g. push
).
Question: how do you manipulate the BPMN list variables in javascript?
do I have to use “Camunda Spin”?