Outputmap directly to java instance variable

Planning to bundle process variables to java POJO’s.

Scenario:
Lets assume I have a Human class with instance variable name, age, and corresponding setters and getters.

The workflow has a processvariable named human with instantiated human pojo.

The workflow runs into a user task form and asking the user for its age. How do I outputmap to the human process variable? I only want to set the age.

Hi @henning,

you can check an example on GitHub: example

First you have to fetch the variable and bind it to a $scope variable.

camForm.on('form-loaded', function() {
  // fetch the variable named 'customerData'
  camForm.variableManager.fetchVariable('customerData');
});

camForm.on('variables-fetched', function() {
  // after the variables are fetched, bind the value of customerData to a angular
  // scope value such that the form can work on it
  $scope.customerData = camForm.variableManager.variable('customerData').value;
});

After that you can bind it to a input with the ng-model directive:

<input id="firstname" class="form-control" type="text" required ng-model="customerData.firstname">

You can’t use generated forms or the cam-variable directive, since a Complex Java Object is usually not bound to a single input field. You can read documentation for this on that page.

regards,
Dominik

Thank you @dominikh.

You are welcome @henning :slight_smile: