Postponing a Human Task - please advise

Hi,

Looking for advice on how to model / implement a postpone task scenario. The process I’m working on has basically 1 task that could either be worked by an Operator and that can eventually be escalated to a Supervisor. Currently it is implemented with two human tasks, on after the other (I know it’s bad :wink:).

An Operator might not have all the information needed to complete the task, so he/she can suspend the task (postpone it). The task can be resumed manually or by an elapsed period of time. For the business is important to know how long has a task been suspended, and they want to use Optimize reports for that.

I’m a little out of ideas and looking for some fresh eyes to share some insight.

Hi @pedro.arroyo

One possible solution would be as follows:
Notice:
A non-interrupting boundary message event has been used to maintain the same task instance.
The Optimize tool can track and analyze the suspension and activation logic.
A flag variable can be used to indicate the status of the task instance (either activated or suspended)

Hi @pedro.arroyo , You can utilize the dueDate attribute while modeling the process, which specifies the due date of the user task.

To postpone the task you can make an api call to set the updated dueDate, so it will postpone the task for the updated dueDate.

Update Task API (PATCH): http://localhost:8080/v2/user-tasks/:userTaskKey

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"changeset\": {\n    \"dueDate\": \"2024-10-02T22:01:21.342Z\",\n    \"followUpDate\": \"2024-10-02T22:01:21.342Z\",\n    \"candidateUsers\": [\n      \"string\"\n    ],\n    \"candidateGroups\": [\n      \"string\"\n    ],\n    \"priority\": 50\n  },\n  \"action\": \"string\"\n}");
Request request = new Request.Builder()
  .url("http://localhost:8080/v2/user-tasks/:userTaskKey")
  .method("PATCH", body)
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();

Based on dueDate variable you can render the reports on optimize as well.

Thank you for your input @hassang :slight_smile:

This is actually what the current implementation is, with a little variation. I don’t love it, though, as it seems too intrusive in the overall process definition. I feel it should be resolved through properties of the human task itself, or by another construct.

Thank you @aravindhrs for your suggestion.

I’m finding difficult to get my head around this solution as to me the task due date and postponing the task are two different things. For example: a task might have a due date defined by an SLA, a user might start working on it, but can’t complete it, therefore he/she postpones the task for a later time.

Essentially this means closing the task and leaving it be in the task list, but when it comes to reporting. The task might show as being in this step for an amount of time that doesn’t necessarily means time spent working on this task.

Hope I was able to make my case clear :slight_smile:

Hi @pedro.arroyo

It appears that the functionality you are looking for is supported in future versions of Optimize.
Your task lifecycle should include the outlined work state actions: start and complete, with optional actions like pause, resume, and return.

https://docs.camunda.io/docs/apis-tools/frontend-development/task-applications/user-task-lifecycle/#task-life-cycle-reporting-in-optimize

You can use the following endpoint to update the action:
User Task Lifecycle API.

1 Like

Yeah that looks promising. We’re moving to 8.5 this semester so we can start playing with that. It would be way better than what we currently have LOL

Thank you @hassang

1 Like