CamSDK: CamForm.escalate and .error: how to close task after submission of sync event?

@martin.stamm How can camForm.escalate and .error be used for sync and async boundary events?

When you call .escalate or .error it will submit the event, but the form does not close (in the case of a sync event). So is it possible to detect if it is a sync/async boundary and thus close or not close the task in the UI ?

After some further investigation, it seems only way to do this is similar to:

camForm.on('escalation-success', function() {
                                if ($scope.camForm.escalationInterrupt){
                                    angular.element('.task-card').scope().dismissTask()
                                } else {
                                    // Clear variable manager if it was a non-interrupting escalation
                                    clearVariableManager()
                                }
                                // https://github.com/camunda/camunda-bpm-webapp/blob/master/ui/cockpit/src/modules/utils/notifications.js#L28-L37
                                inject(['Notifications', function(Notifications) {
                                    let taskId = $scope.camForm.taskId

                                    Notifications.addMessage({
                                        type: 'info',
                                        duration: 3500,
                                        status: 'Escalation Created',
                                        message: 'Escalation was triggered for Task ' + taskId
                                    });
                                }]);
                            })

x-ref for similar issue: Dismissing task form for inexistent task

Hi @StephenOTT,

unfortunately the REST Api does not provide information about the type of escalation after an error was triggered[1][2].

The only way I can see it is calling $scope.$emit('refresh'); in the escalation-success event handler to force Tasklist to check all tasks again.

1: https://docs.camunda.org/manual/7.13/reference/rest/task/post-bpmn-error/
2: https://docs.camunda.org/manual/7.13/reference/rest/task/post-bpmn-escalation/

1 Like

@martin.stamm good idea. Will give that one a try as well.