Direct popup feedback when executing processes

Hello,
we have some “Administration” processes which are only executed by IT operations by using the Camunda cockpit (tasklist -> start process). These processes only have 1 service task (implemented in Java).
The processes work fine, but IT operations want to have a direct feedback when the process was executed successfully (and showing some result values).
The feedback should be a browser popup or a website which shows up.
Which is the easiest way to implement this requirement?
We tried to make a javascript script task which shows a popup (like window.alert (“process was executed with result = …”):wink: but this dows not work.
Any ideas?

What I did in a similar case was to introduce a user task where users can review and acknowledge the result.

I changed the service task to a Send Task with a Java Delegate that adds the processInstanceId to the outgoing call (you might be able to achieve that in a script, too):

public void execute(DelegateExecution delegateExecution) throws Exception {

    HttpConnector http = Connectors.getConnector(HttpConnector.ID);

    JSONObject jsonObject = new JSONObject();
    jsonObject.put("processInstanceId", delegateExecution.getProcessInstanceId());

    HttpResponse httpResponse = http.createRequest()
        .post()
        .url(url)
        .contentType("application/json")
        .payload(jsonObject.toString())
        .execute();

    HttpStatus httpStatus = HttpStatus.resolve(httpResponse.getStatusCode());
    if (httpStatus.isError()) {
        JSONObject responseJson = new JSONObject(httpResponse.getResponse());
        throw new RuntimeException(responseJson.getString("message"));
    }
}

and designed a Receive Task which gets triggered by a callback from the backend to the Camunda rest service’s /message resource which receives a message containing the same processInstanceId with some additional result variables.

After the Receive Task I have a User Task which shows the result variables.

My backend immediately responds with Http 202 Accepted which effectively makes the process asychronous, and later POSTs back to the Camunda rest service.

Since it is possible for users to start several process instances, it makes sense to stay within the “You have a new task” metaphor once a process is done; modal popups wouldn’t be a good fit.

The start event has an Initiator starter and I let Camunda automatically assign the user tasks to ${starter}. In addition, I have a tasklist filter with automatic refresh activated. Thus, users see the review result task as soon as the callback comes in.

1 Like

This is a smart hack; thanks for sharing!! I will consider it!