How to obtain active tasks for a case

1
+1
-1

Hi,

I need to obtain the list of active tasks and the users asignned for a case.

With this API: /API/bpm/caseInfo/caseID I can get the list of the active tasks, but the API doesn't return the user asignned to each task.

Thanks.

1 answer

1
+2
-1
This one is the BEST answer!

Hi,

There are several REST API calls which can be used to search tasks, but none of them can be used to filter directly the already assigned tasks.

In your situation you migth want to develop a REST API Extension, which would return the information requested.

Or, there is below an example using the API/bpm/humanTask REST API call, within a UIDesigner Form.
GET requests from within a UIDesigner form are generated with a variable with type External API.

There is below an example using 2 variables within a UIDesigner process form, which retrieve all assigned human tasks for the case with id 1001.

Create a new variable to list all human tasks in ready state and associated to case with id 1001
- name humanTasksOfACase, Type External API, Value ../API/bpm/humanTask/?p=0&c=10&f=caseId%3D1001&f=state%3Dready

Create a new variable to forge the list of assigned tasks from the humanTasksOfACase variable:
- name assignedHumanTasks, type Javascript expression, value

var humanTasks = $data.humanTasksOfACase;
var humanTasksSize = humanTasks.length;
var assignedHumanTasksFound = [];
for (var i=0; i<humanTasksSize; i++) {
  try {
    if (humanTasks[i].assigned_id) {
      assignedHumanTasksFound.push(humanTasks[i]);
    }
  } catch (e) {
    // ignore
  }
}
return assignedHumanTasksFound;

Regards,
Jerome

Comments

Submitted by jpineda_1 on Tue, 02/19/2019 - 16:04

Hi Jerome,

Thanks for your help, this should work for me.

Regards,

Jorge

Notifications