Here is may java Delegate class which i use for getting output variable:
public class DocumentItem implements JavaDelegate{
public void execute(DelegateExecution arg0) throws Exception {
JSONObject jsonObject1;
JSONArray jsonArray = new JSONArray(arg0.getVariable("restResponse").toString());
for(int i=0;i<jsonArray.length();i++)
{
jsonObject1 = jsonArray.getJSONObject(i);
}
}
}
and i want to create camVariable in my start form :
var documentData = $scope.documentData = {
};
// hook into camunda SDK JS Form Lifecycle
camForm.on('form-loaded', function() {
camForm.variableManager.createVariable({
name: 'jsonObject1',
type: 'Object',
value: jsonObject1,
valueInfo: {
// indicate that object is serialized as json
serializationDataFormat: 'application/json',
objectTypeName: 'org.camunda.bpm.engine.impl.util.json.JSONObject'
}
});
});
</script>
<h2>My job List</h2>
<div>
<table style="width:100%;">
<thead>
<tr>
<th style="width:140px;">id</th>
<th style="width:305px;">organizationNameEN</th>
<th style="width:250px;">organizationNameGe</th>
<th style="width:75px;" >cardNumber</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><input style="width:140px;" type="long" id="id" class="control-group" ng-model="jsonObject1.id" readonly /></td>
<td><input style="width:305px;" type="text" id="cardNumber" class="control-groupl" ng.model="jsonObject1.cardNumber" /></td>
<td><input style="width:250px;" type="text" id="OrganizationNameGE" class="control-group" ng.model="jsonObject1.OrganizationNameGE"/></td>
<td><input style="width:25px; height:25px;" type="checkbox" ng-model="chekselct"
cam-variable-name="isItemSelected"
cam-variable-type="Boolean" /></td>
<td ng-show="chekselct">extra Data: <input style="width:60px;" type="number"
cam-variable-name="id" min="1"
cam-variable-type="Integer" /></td>
</tr>
</tbody>
</table>
</div>
</form>
But every time i deploy war file in camunda environment i got this error:Form failure: jsonObject1 is not defined
What should i change to make this code work?