Tasks
Service for managing UiPath Action Center
Tasks are task-based automation components that can be integrated into applications and processes. They represent discrete units of work that can be triggered and monitored through the UiPath API. UiPath Action Center Guide
Methods¶
getAll()¶
getAll<T>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskGetResponse> : NonPaginatedResponse<TaskGetResponse>>;
Gets all tasks across folders with optional filtering
Type Parameters¶
Type Parameter | Default type |
---|---|
T extends TaskGetAllOptions |
TaskGetAllOptions |
Parameters¶
Parameter | Type | Description |
---|---|---|
options? |
T |
Query options including optional folderId and pagination options |
Returns¶
Promise
<T
extends HasPaginationOptions
<T
> ? PaginatedResponse
<TaskGetResponse
> : NonPaginatedResponse
<TaskGetResponse
>>
Promise resolving to either an array of tasks NonPaginatedResponse
Example¶
// Standard array return
const tasks = await sdk.tasks.getAll();
// Get tasks within a specific folder
const tasks = await sdk.tasks.getAll({
folderId: 123
});
// First page with pagination
const page1 = await sdk.tasks.getAll({ pageSize: 10 });
// Navigate using cursor
if (page1.hasNextPage) {
const page2 = await sdk.tasks.getAll({ cursor: page1.nextCursor });
}
// Jump to specific page
const page5 = await sdk.tasks.getAll({
jumpToPage: 5,
pageSize: 10
});
getById()¶
Gets a task by ID IMPORTANT: For form tasks, folderId must be provided.
Parameters¶
Parameter | Type | Description |
---|---|---|
id |
number |
The ID of the task to retrieve |
options? |
BaseOptions |
Optional query parameters |
folderId? |
number |
Optional folder ID (REQUIRED for form tasks) |
Returns¶
Promise
<TaskGetResponse
>
Promise resolving to the task TaskGetResponse
Example¶
// Get a task by ID
const task = await sdk.tasks.getById(<taskId>);
// Get a form task by ID
const formTask = await sdk.tasks.getById(<taskId>, <folderId>);
// Access form task properties
console.log(formTask.formLayout);
create()¶
Creates a new task
Parameters¶
Parameter | Type | Description |
---|---|---|
options |
TaskCreateOptions |
The task to be created |
folderId |
number |
Required folder ID |
Returns¶
Promise
<TaskCreateResponse
>
Promise resolving to the created task TaskCreateResponse
Example¶
import { TaskPriority } from '@uipath/uipath-typescript';
const task = await sdk.tasks.create({
title: "My Task",
priority: TaskPriority.Medium
}, <folderId>); // folderId is required
assign()¶
assign(options:
| TaskAssignmentOptions
| TaskAssignmentOptions[]): Promise<OperationResponse<
| TaskAssignmentOptions[]
| TaskAssignmentResponse[]>>;
Assigns tasks to users
Parameters¶
Parameter | Type | Description |
---|---|---|
options |
| TaskAssignmentOptions | TaskAssignmentOptions [] |
Single task assignment or array of task assignments |
Returns¶
Promise
<OperationResponse
<
| TaskAssignmentOptions
[]
| TaskAssignmentResponse
[]>>
Promise resolving to array of task assignment results TaskAssignmentResponse
Example¶
// Assign a single task to a user by ID
const result = await sdk.tasks.assign({
taskId: <taskId>,
userId: <userId>
});
// Assign a single task to a user by email
const result = await sdk.tasks.assign({
taskId: <taskId>,
userNameOrEmail: "user@example.com"
});
// Assign multiple tasks
const result = await sdk.tasks.assign([
{ taskId: <taskId1>, userId: <userId> },
{ taskId: <taskId2>, userNameOrEmail: "user@example.com" }
]);
reassign()¶
reassign(options:
| TaskAssignmentOptions
| TaskAssignmentOptions[]): Promise<OperationResponse<
| TaskAssignmentOptions[]
| TaskAssignmentResponse[]>>;
Reassigns tasks to new users
Parameters¶
Parameter | Type | Description |
---|---|---|
options |
| TaskAssignmentOptions | TaskAssignmentOptions [] |
Single task assignment or array of task assignments |
Returns¶
Promise
<OperationResponse
<
| TaskAssignmentOptions
[]
| TaskAssignmentResponse
[]>>
Promise resolving to array of task assignment results TaskAssignmentResponse
Example¶
// Reassign a single task to a user by ID
const result = await sdk.tasks.reassign({
taskId: <taskId>,
userId: <userId>
});
// Reassign a single task to a user by email
const result = await sdk.tasks.reassign({
taskId: <taskId>,
userNameOrEmail: "user@example.com"
});
// Reassign multiple tasks
const result = await sdk.tasks.reassign([
{ taskId: <taskId1>, userId: <userId> },
{ taskId: <taskId2>, userNameOrEmail: "user@example.com" }
]);
unassign()¶
unassign(taskId: number | number[]): Promise<OperationResponse<
| TaskAssignmentResponse[]
| {
taskId: number;
}[]>>;
Unassigns tasks (removes current assignees)
Parameters¶
Parameter | Type | Description |
---|---|---|
taskId |
number | number [] |
Single task ID or array of task IDs to unassign |
Returns¶
Promise
<OperationResponse
<
| TaskAssignmentResponse
[]
| {
taskId
: number
;
}[]>>
Promise resolving to array of task assignment results TaskAssignmentResponse
Example¶
// Unassign a single task
const result = await sdk.tasks.unassign(<taskId>);
// Unassign multiple tasks
const result = await sdk.tasks.unassign([<taskId1>, <taskId2>, <taskId3>]);
complete()¶
complete(
taskType: TaskType,
options: TaskCompletionOptions,
folderId: number): Promise<OperationResponse<TaskCompletionOptions>>;
Completes a task with the specified type and data
Parameters¶
Parameter | Type | Description |
---|---|---|
taskType |
TaskType |
The type of task (Form, App, or External) |
options |
TaskCompletionOptions |
The completion options |
folderId |
number |
Required folder ID |
Returns¶
Promise
<OperationResponse
<TaskCompletionOptions
>>
Promise resolving to completion result TaskCompletionOptions
Example¶
// Complete an app task
await sdk.tasks.complete(TaskType.App, {
taskId: <taskId>,
data: {},
action: "submit"
}, <folderId>); // folderId is required
// Complete an external task
await sdk.tasks.complete(TaskType.External, {
taskId: <taskId>
}, <folderId>); // folderId is required
getUsers()¶
getUsers<T>(folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<UserLoginInfo> : NonPaginatedResponse<UserLoginInfo>>;
Gets users in the given folder who have Tasks.View and Tasks.Edit permissions Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided, or a PaginatedResponse when any pagination parameter is provided
Type Parameters¶
Type Parameter | Default type |
---|---|
T extends TaskGetUsersOptions |
TaskGetUsersOptions |
Parameters¶
Parameter | Type | Description |
---|---|---|
folderId |
number |
The folder ID to get users from |
options? |
T |
Optional query and pagination parameters |
Returns¶
Promise
<T
extends HasPaginationOptions
<T
> ? PaginatedResponse
<UserLoginInfo
> : NonPaginatedResponse
<UserLoginInfo
>>
Promise resolving to either an array of users NonPaginatedResponse