Camunda Unsupported value type 'Array'


#1

I want to use json Array as camVariable to pass it second form and than trasnform this data into forms , but
when i try this camunda throws exception like this:Unsupported value type ‘Array’ , is there any way i can transfer this json array data to another camVariable?
first part of my form:
var arr = $scope.arr = [
{
“id”: 1,
“organizationNameGE”: “პსდა”,
“organizationNameEN”: “psda”,
“cardNumber”: “12345”
},
{
“id”: 1,
“organizationNameGE”: “პსდა”,
“organizationNameEN”: “psda”,
“cardNumber”: “12345”
} ];

    camForm.on('form-loaded', function() {
      camForm.variableManager.createVariable({
        name: 'arr',
        type: 'Array',
        value: arr
      });
    });

second part of my form:
camForm.on(‘form-loaded’, function() {
// tell the form SDK to fetch the variable named ‘document’
camForm.variableManager.fetchVariable(‘arr’);
});
camForm.on(‘variables-fetched’, function() {
// work with the variable (bind it to the current AngularJS $scope)
$scope.arr = camForm.variableManager.variableValue(‘arr’);
});

@kristin you are always very helpful, can you give me any helpful advice in this case?


#2

@Sally https://docs.camunda.org/manual/7.8/user-guide/process-engine/variables/#supported-variable-values

Array is not a support variable type.

If you need store a type Json and then when you get the json back, you can JSON.parse(myJsonVariable) from a string back into a JS object