Get Variables (objects) in an embedded form

I’m using a Java Delegate to set a process variable:

List<String> softwareList = new ArrayList<>();
softwareList.add("Example");
execution.setVariable("softwareList", softwareList);

And then i try to loop over softwareList and store each item as ìtem.

I have a Human Task in that form, which uses a embedded task form to display process variables.

  <script cam-script type="text/form-script">
  inject(['$scope', '$http', function($scope, $http) {
    var variableManager = camForm.variableManager;
    
    // OnFormLoaded
    camForm.on('form-loaded', function() {
      // Fetch Variables
      // - General
      variableManager.fetchVariable('processInitiator'); // set by the engine
      // - Process
      variableManager.fetchVariable('userName'); // set in an earlier form
      variableManager.fetchVariable('softwareList');
      variableManager.fetchVariable('item');
    });
    
    // OnVariablesFetched
    camForm.on('variables-fetched', function() {
      // After the variables are fetched, bind the value to the angular scope
      // - General
      $scope.processInitiator = variableManager.variable('processInitiator').value;
      
      // - Process
      $scope.userName = variableManager.variable('userName').value;
      $scope.softwareList= variableManager.variable('softwareList').value;
      $scope.item = variableManager.variable('item').value;
      
      console.log($scope.processInitiator); // works perfectly
      console.log($scope.userName ); // works perfectly
      console.log($scope.softwareList); // writes a serialized string
      console.log($scope.item); // writes a serialized string
    });
  }]);
  </script>

Does someone know how i can access the actual softwareList and item - or how i can deserialize the response from the camunda engine? I do want the engine to return json so that i can display that data.

Example Value in the Console:

rO0ABXNyACFkZS52ZXJzYXRlbC5icG0ubW9kZWwuQXBwbGljYXRpb24r0Iyuig4C6gIAEEwADWFkR3JvdXBDaXRyaXh0ABJMamF2YS9sYW5nL1N0cmluZztMAAthZEdyb3VwU2NjbXEAfgABTAAHYXBwVHlwZXEAfgABTAAZYXBwcm92YWxMaWNlbnNlTWFuYWdlbWVudHQAE0xqYXZhL2xhbmcvQm9vbGVhbjtMABBhcHByb3ZhbFN1cGVyaW9ycQB+AAJMAAhjYXRlZ29yeXEAfgABTAAKZGVwcmVjYXRlZHEAfgACTAALZGVzY3JpcHRpb25xAH4AAUwAAmlkdAATTGphdmEvbGFuZy9JbnRlZ2VyO0wAB2xpY2Vuc2VxAH4AAkwABG5hbWVxAH4AAUwAB3BpY3R1cmVxAH4AAUwACHByb2R1Y2VycQB+AAFMABRwcm92aXNpb25lZEJ5RGVmYXVsdHEAfgACTAAOc2VsZkFzc2lnbmFibGVxAH4AAkwAB3ZlcnNpb25xAH4AAXhwdAAAcQB+AAV0AAtBcHBsaWNhdGlvbnNyABFqYXZhLmxhbmcuQm9vbGVhbs0gcoDVnPruAgABWgAFdmFsdWV4cAFxAH4ACHQABFRlc3RzcQB+AAcAdAAEVGV4dHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABcQB+AAp0AARUZXN0cQB+AAV0AApIZXJzdGVsbGVycQB+AApxAH4ACnQAAzAuMQ==

I found the solution.

I needed to add camunda spin and set the defaultSerializationFormat of the engine to application/json.

Can you attach your code? How add Camunda spin?

There is no code, it’s a jar dependency you include into the project - just search maven central for camunda spin to find it. After that check out the documentation on the engine configuration to set defaultSerializationFormat to application/json.

Thanks. I decided like this