How to destroy CamSDK.Form Object


I have integrated forms using camunda-bpm-sdk-angular module. I am facing difficulties with CamSDK.Form Object. When user select Task, we are calling function “focusTask”, which loads up appropriate form with creating object i.e. CamSDK.Form. However completion call back that we pass as “done” param calls multiple times when user click submit button of different Task. It actually creates new Object every click on Task. I tried using “cleanLocalStorage” to destroy Object of previously selected task, but it did not work. Could you please help resolving this issue ?

$scope.focusTask = function($event, task) {
var camClient = new CamSDK.Client({
mock: false,
apiUri: $rootScope.envProperties.COMM_ENV_URL + ‘/engine-rest’,
headers: {Authorization: Session.authorization , Accept:‘application/json’, Accept:‘application/hal+json, application/json; q=0.5’}
$scope.task = task;
var formContainer = $(’.form-container’);
var taskService = new camClient.resource(‘task’);
var taskId =;
taskService.form(taskId, function(err, taskFormInfo) {
var url = taskFormInfo.key.replace(‘embedded:app:’, taskFormInfo.contextPath + ‘/’);
new CamSDK.Form({
client: camClient,
formUrl: $rootScope.envProperties.COMM_ENV_URL + url,
processDefinitionId: task.processDefinitionId,
processDefinitionKey: task.processDefinitionKey,
containerElement: formContainer,
done: $scope.completionCallBack

	  $scope.completionCallBack  = function(err, camForm) {