Manages Task Instances.
TaskDetailsModel
): Observable
<
TaskDetailsModel
>
TaskDetailsModel
- The task to addObservable
<
TaskDetailsModel
>
- The subtask that was addedstring
, requestNode: any
): Observable
<
TaskDetailsModel
>
string
- The task to assignany
- User or group to assign the task toObservable
<
TaskDetailsModel
>
- Details of the assigned taskstring
, userId: string
): Observable
<
TaskDetailsModel
>
string
- ID of the task to assignstring
- ID of the user to assign the task toObservable
<
TaskDetailsModel
>
- Details of the assigned taskstring
, formId: number
): Observable
<any>
string
- ID of the target tasknumber
- ID of the form to addObservable
<any>
- Null response notifying when the operation is completestring
): Observable
<
TaskDetailsModel
>
string
- ID of the task to claimObservable
<
TaskDetailsModel
>
- Details of the claimed taskstring
): Observable
<any>
string
- ID of the target taskObservable
<any>
- Null response notifying when the operation is completeTaskDetailsModel
): Observable
<
TaskDetailsModel
>
TaskDetailsModel
- Details of the new taskObservable
<
TaskDetailsModel
>
- Details of the newly created taskstring
): Observable
<
TaskDetailsModel
>
string
- Task id related to formObservable
<
TaskDetailsModel
>
- Null response notifying when the operation is completestring
): Observable
<
TaskDetailsModel
>
string
- The task to deleteObservable
<
TaskDetailsModel
>
- Null response notifying when the operation is completestring
): Observable
<any>
string
- ID of the target taskObservable
<any>
- JSON datastring
): Observable
<
Blob
>
string
- ID of the target taskObservable
<
Blob
>
- Binary PDF dataTaskQueryRequestRepresentationModel
, state?: string
): Observable
<
TaskListModel
>
TaskQueryRequestRepresentationModel
- Query to search for tasks.string
- (Optional) Task state. Can be "open" or "completed".Observable
<
TaskListModel
>
- List of tasksTaskQueryRequestRepresentationModel
): Observable
<
TaskListModel
>
TaskQueryRequestRepresentationModel
- Query to search for tasksObservable
<
TaskListModel
>
- List of tasksTaskQueryRequestRepresentationModel
, state?: string
): Observable
<
TaskListModel
>
TaskQueryRequestRepresentationModel
- Query to search for tasksstring
- (Optional) Task state. Can be "open" or "completed".Observable
<
TaskListModel
>
- List of tasksstring
, filterList: FilterRepresentationModel
[]
): Observable
<
FilterRepresentationModel
>
string
- ID of the target taskFilterRepresentationModel
[]
- List of filters to search throughObservable
<
FilterRepresentationModel
>
- Filters belonging to the taskObservable
<
Form
[]>
Observable
<
Form
[]>
- Array of form detailsstring
): Observable
<
TaskDetailsModel
[]>
string
- ID of the target taskObservable
<
TaskDetailsModel
[]>
- Array of checklist task detailsstring
): Observable
<
TaskDetailsModel
>
string
- ID of the target task.Observable
<
TaskDetailsModel
>
- Task detailsTaskQueryRequestRepresentationModel
): Observable
<
TaskListModel
>
TaskQueryRequestRepresentationModel
- Query to search for tasksObservable
<
TaskListModel
>
- List of tasksTaskQueryRequestRepresentationModel
): Observable
<any>
TaskQueryRequestRepresentationModel
- Query to search for tasksObservable
<any>
- Number of tasksstring
, filterModel: FilterRepresentationModel
): Observable
<
FilterRepresentationModel
>
string
- ID of the target taskFilterRepresentationModel
- The filter you want to checkObservable
<
FilterRepresentationModel
>
- The filter if it is related or null otherwisestring
): Observable
<
TaskDetailsModel
>
string
- ID of the task to unclaimObservable
<
TaskDetailsModel
>
- Null response notifying when the operation is completestring
, updated: TaskUpdateRepresentation
): Observable
<
TaskDetailsModel
>
string
- ID of the task to updateTaskUpdateRepresentation
- Data to update the task (as a TaskUpdateRepresentation
instance).Observable
<
TaskDetailsModel
>
- Updated task detailsSeveral of the methods return one or more TaskDetailsModel
instances corresponding
to tasks or subtasks matched by a query of some kind. For example, getTaskDetails
could be used as shown below:
const taskInstanceId = '15303';
this.tasklistService.getTaskDetails(taskInstanceId).subscribe( (taskInstance: TaskDetailsModel) => {
console.log('TaskInstance: ', taskInstance);
}, error => {
console.log('Error: ', error);
});
The resulting TaskDetailsModel
object contains information like the following:
adhocTaskCanBeReassigned: false
assignee: UserProcessModel {pictureId: null, id: 1, email: "[email protected]", firstName: null, lastName: "Administrator"}
category: null
created: Wed Oct 11 2017 09:07:14 GMT+0100 (BST) {}
description: null
dueDate: null
duration: null
endDate: null
executionId: "11337"
formKey: "9"
id: "15303"
initiatorCanCompleteTask: false
involvedPeople: []
managerOfCandidateGroup: false
memberOfCandidateGroup: false
memberOfCandidateUsers: false
name: "Clarify Invoice - Invoice-20302.pdf"
parentTaskId: null
parentTaskName: null
priority: 50
processDefinitionCategory: "http://www.activiti.org/processdef"
processDefinitionDeploymentId: "18"
processDefinitionDescription: "This is a simple invoice approval process that allows a person to assign a dedicated approver for the the invoice. It will then be routed to the Accounting department for payment preparation. Once payment is prepared the invoice will be stored in a specific folder and an email notification will be sent."
processDefinitionId: "InvoiceApprovalProcess:2:21"
processDefinitionKey: "InvoiceApprovalProcess"
processDefinitionName: "Invoice Approval Process"
processDefinitionVersion: 2
processInstanceId: "11337"
processInstanceName: null
processInstanceStartUserId: "1"
taskDefinitionKey: "clarifyInvoice"
Some of the methods run a search query contained in a TaskQueryRequestRepresentationModel
and
return the matched tasks. Below is an example of how you might run a query using getTasks
:
const taskQuery: TaskQueryRequestRepresentationModel = {
appDefinitionId: '2',
processInstanceId: null,
processDefinitionId: null,
text: null,
assignment: null,
state: 'open',
sort: 'created_asc',
page: 0,
size: 5,
start: null
};
this.tasklistService.getTasks(taskQuery).subscribe( (taskListModel: TaskListModel) => {
console.log('Task List Model: ', taskListModel);
}, error => {
console.log('Error: ', error);
});
In this example, the query specifies all Task Instances for the process app with
ID 2. Setting the size
property to 5 ensures the query will return no more than
five task instances in the results.
You can use various query parameters to narrow down the scope of the results.
If you are only interested in task instances related to a specific process instance,
then you can set the processInstanceId
accordingly. If you want all tasks related to
a type of process then you can use processDefinitionId
.
Use the state
property to indicate that you want only "completed" or "open" tasks (this
defaults to "open" if you leave it undefined).
The assignment
property filters tasks based on how they are assigned (or not assigned yet).
Use assignee
if you are interested in tasks that are assigned to a user. If you want to see
pooled tasks (i.e. tasks that needs to be claimed by a user), then use candidate
.
A successful query returns a TaskListModel
with the data
property set to an array of
TaskDetailsModel
:
data: 0: {id: "75010", name: "Approve Invoice - Invoice-10202.pdf", description: null, category: null, assignee: {…}, …} 1: {id: "74746", name: "Verify with the person that did the purchase", description: null, category: "2", assignee: {…}, …} 2: {id: "74745", name: "Double check invoice amount", description: null, category: "2", assignee: {…}, …} 3: {id: "20686", name: "Sample checklist task 1", description: null, category: "2", assignee: {…}, …} 4: {id: "15303", name: "Clarify Invoice - Invoice-20302.pdf", description: null, category: null, assignee: {…}, …} length: 5 size: 5 start: 0 total: 10
The total
property indicates that actual number of tasks that were found, but the size
property
limited the found set to five items.
import { TaskListService, TaskDetailsModel, TaskQueryRequestRepresentationModel, TaskListModel, Form } from '@alfresco/adf-process-services';
import { TaskUpdateRepresentation } from '@alfresco/js-api';
class SomePageComponent implements OnInit {
constructor(private tasklistService: TaskListService) {
}
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.