Available API
Inside a form script, the following built-in variables and functions are available:
camForm
The camForm
variable is an instance of the CamSDK.Form
class. It is the primary access point to
the form API and allows definition of event handers for participation in the form lifecycle:
<form role="form">
...
<script cam-script type="text/form-script">
var variableManager = camForm.variableManager;
camForm.on('variables-fetched', function() {
// access to all process variables after the form has loaded
console.log(variableManager.variables);
});
</script>
</form>
$scope
Only available with AngularJS integration.
Please note that AngularJS is not supported in the CIB seven webclient due to security considerations: AngularJS support has officially ended as of January 2022. While AngularJS remains available in the Camunda web applications, these applications will be deprecated and removed in future releases of CIB seven.
Provides access to the current AngularJS scope:
<form role="form">
<input type="text"
cam-variable-name="CUSTOMER_ID"
cam-variable-type="String"
ng-model="customerId" />
<script cam-script type="text/form-script">
camForm.on('variables-applied', function() {
// the input field is bound to $scope.customerId
$scope.customerId = "some-id";
});
</script>
</form>
inject()
Only available with AngularJS integration.
Please note that AngularJS is not supported in the CIB seven webclient due to security considerations: AngularJS support has officially ended as of January 2022. While AngularJS remains available in the Camunda web applications, these applications will be deprecated and removed in future releases of CIB seven.
<form role="form">
<script cam-script type="text/form-script">
inject(['$http', 'Uri', function($http, Uri) {
camForm.on('form-loaded', function() {
// use injected $http service for making requests, e.g.
$http.get(Uri.appUri('engine://engine/:engine/task/' + camForm.taskId)).then(function(task) {
$scope.task = task;
});
});
}]);
</script>
</form>