I Used this Script in my camunda form:
<form name="customerForm" role="form">
<script cam-script type="text/form-script">
var customerData = $scope.customerData = {
addresses : []
};
$scope.addAddress = function() {
customerData.addresses.push({});
};
camForm.on('form-loaded', function() {
camForm.variableManager.createVariable({
name: 'customerData',
type: 'Object',
value: customerData,
valueInfo: {
serializationDataFormat: 'application/json',
objectTypeName: 'org.camunda.bpm.spring.boot.example.twitter.CustomerData'
}
});
});
camForm.on('submit', function() {
angular.forEach(customerData.addresses, function(addr) {
delete addr.$$hashKey;
});
});
</script>
<h3>Customer Data</h3>
<div class="control-group">
<label class="control-label" for="firstname">First Name</label>
<div class="controls">
<input id="firstname"
class="form-control"
type="text"
required
ng-model="customerData.firstname">
</div>
</div>
<div class="control-group">
<label class="control-label" for="lastname">Last Name</label>
<div class="controls">
<input id="lastname"
class="form-control"
type="text"
required
ng-model="customerData.lastname">
</div>
</div>
<div class="control-group">
<label class="control-label" for="vip">Is VIP Customer</label>
<div class="controls">
<input id="vip"
class="form-control"
type="checkbox"
ng-model="customerData.vip">
</div>
</div>
<div>
<h3>Addresses</h3>
<a href
ng-click="addAddress()"
class="btn btn-default">Add</a>
<div ng-repeat="addr in customerData.addresses">
<hr>
<div class="control-group">
<label class="control-label" for="street">Street</label>
<div class="controls">
<input id="street"
class="form-control"
type="text"
required
ng-model="addr.street">
</div>
</div>
<div class="control-group">
<label class="control-label" for="zip">Zip</label>
<div class="controls">
<input id="zip"
class="form-control"
type="text"
required
ng-model="addr.zipCode">
</div>
</div>
<div class="control-group">
<label class="control-label" for="city">City</label>
<div class="controls">
<input id="city"
class="form-control"
type="text"
required
ng-model="addr.city">
</div>
</div>
<div class="control-group">
<label class="control-label" for="country">Country</label>
<div class="controls">
<select id="country"
class="form-control"
required
ng-model="addr.country">
<option>Germany</option>
<option>France</option>
<option>Italy</option>
<option>Luxembourg</option>
</select>
</div>
</div>
</div>
</div>
</form>
and I got this error
The process could not be started. : Cannot instantiate process definition createRating:1:1eed70bf-e4ba-11ec-afcd-764adfcc4004: Cannot find serializer for value 'ObjectValue [value=null, isDeserialized=false, serializationDataFormat=application/json, objectTypeName=org.camunda.bpm.spring.boot.example.twitter.CustomerData, serializedValue=130 chars, isTransient=false]'.
how can I fix it?
Note: objectTypeName is correct I checked it
Most likely reason is that the distribution you are using does not include the CAMUNDA SPIN libraries. See: https://docs.camunda.org/manual/7.17/user-guide/data-formats/ and https://docs.camunda.org/manual/7.17/user-guide/data-formats/json/
If you are using Maven, add:
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-plugin-spin</artifactId>
</dependency>
<dependency>
<groupId>org.camunda.spin</groupId>
<artifactId>camunda-spin-dataformat-all</artifactId>
</dependency>