How to obtain active tasks for a case
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
Hi Jerome,
Thanks for your help, this should work for me.
Regards,
Jorge