Showing progress feedback in tasklist


#1

I have a process with long-running external backend tasks. My users want to see some feedback in the task list wich tells them about the progress in the backend. I can post progress information from the backend to the Camunda rest service and add that information to process variables.

What I am considering is a user task with an embedded form which gets assigned to the current user after the backend call,

image

hoping that I can poll the Camunda backend from the browser to get the current process variables.

  • Is there an official way to tell an embedded form to update itself using JavaScript?
  • Has anyone done a similar thing in the past?

#2

@dschulten… We have a similar use case where we have a log running process with multiple task. I had created a dash board to gather the stats from the backend and on the back end I have a user pattern that is created around user task that runs everyday morning to update the stats on a back end table (as well as send an email) that is used by the task board. the pattern looks something like this.


#3

First I thought I could simply ask the VariableManager to fetch the same variables again, but that did not work, an error message appears that the variable has already been fetched.

Then I found https://docs.camunda.org/manual/7.6/reference/embedded-forms/javascript/api/#inject and derived a way to retrieve variables periodically from the webapp restapi:

<script cam-script type="text/form-script">
inject(['$http', 'Uri', function($http, Uri) {
    camForm.on('variables-fetched', function() {
      var interval = window.setInterval(function() {
          // debugger;
          // use injected $http service for making requests, e.g.
          $http.get(Uri.appUri('engine://engine/:engine/task/' + 
                camForm.taskId + '/variables')).success(function(variables) {
            $scope.myVariables = variables;
          });
        }, 2000);
    });
}]);
</script>

Two issues with that:

  • There seems to be no form lifecycle event which tells me that the form is unloaded and I can stop the interval, or is there such an event?
  • I totally circumvent the VariableManager - might be OK in this case, but the manager has no idea that variables have changed since the form was loaded.