Skip to content

TaskMethods

Methods

assign()

assign(options: TaskAssignOptions): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>

Assigns this task to a user or users

Parameters

Parameter Type Description
options TaskAssignOptions Assignment options (requires at least one of: userId, userNameOrEmail)

Returns

Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>

Promise resolving to task assignment results


complete()

complete(options: TaskCompleteOptions): Promise<OperationResponse<TaskCompletionOptions>>

Completes this task with optional data and action

Parameters

Parameter Type Description
options TaskCompleteOptions Completion options

Returns

Promise<OperationResponse<TaskCompletionOptions>>

Promise resolving to completion result


createComment()

createComment(text: string, options?: FolderScopedOptions): Promise<TaskCommentGetResponse>

Creates a comment on this task.

Parameters

Parameter Type Description
text string Comment text (max 512 characters)
options? FolderScopedOptions Optional folder scope override (defaults to this task's folder)

Returns

Promise<TaskCommentGetResponse>

Promise resolving to the created comment TaskCommentGetResponse


editMetadata()

editMetadata(options?: TaskEditMetadataOptions): Promise<void>

Edits this task's metadata (title, priority, catalog association, etc.).

Parameters

Parameter Type Description
options? TaskEditMetadataOptions Fields to change plus optional folder scope override (defaults to this task's folder)

Returns

Promise<void>

Promise resolving once the edit completes


getComments()

getComments<T>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskCommentGetResponse> : NonPaginatedResponse<TaskCommentGetResponse>>

Gets the comments on this task.

Type Parameters

Type Parameter Default type
T extends TaskCommentGetByTaskIdOptions TaskCommentGetByTaskIdOptions

Parameters

Parameter Type Description
options? T Optional folder scope override (defaults to this task's folder) plus query and pagination options

Returns

Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskCommentGetResponse> : NonPaginatedResponse<TaskCommentGetResponse>>

Promise resolving to either a NonPaginatedResponse or PaginatedResponse of TaskCommentGetResponse items, paginated when pagination options are used.


getSchema()

getSchema(options?: FolderScopedOptions): Promise<null | TaskGetSchemaResponse>

Experimental

Gets this task's schema: the fields it holds and the outcomes it can be completed with.

Supported for App tasks and QuickForm tasks; the type of the response tells which shape schema has. An App task's schema has no fields and no outcomes when the caller cannot view apps in the task's folder, when the token lacks the Apps or Apps.Read scope, or when the task's app is no longer deployed there. Other task types return null. A Form task's form definition is its formLayout, returned by getById().

Parameters

Parameter Type Description
options? FolderScopedOptions Optional folder scope override (defaults to this task's folder)

Returns

Promise<null | TaskGetSchemaResponse>

Promise resolving to a TaskGetSchemaResponse, or null when the task has no schema (task types other than App and QuickForm, or a task whose schema is not available).


reassign()

reassign(options: TaskAssignOptions): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>

Reassigns this task to a new user

Parameters

Parameter Type Description
options TaskAssignOptions Assignment options (requires at least one of: userId, userNameOrEmail)

Returns

Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>

Promise resolving to task assignment results


saveData()

saveData(data: Record<string, unknown>, options?: FolderScopedOptions): Promise<void>

Saves this task's data (form/task payload), replacing the existing payload.

Parameters

Parameter Type Description
data Record<string, unknown> The task data to save
options? FolderScopedOptions Optional folder scope override (defaults to this task's folder)

Returns

Promise<void>

Promise resolving once the save completes


saveTags()

saveTags(tags: Tag[], options?: FolderScopedOptions): Promise<void>

Saves the tags on this task, replacing any existing tags.

Parameters

Parameter Type Description
tags Tag[] The tags to set
options? FolderScopedOptions Optional folder scope override (defaults to this task's folder)

Returns

Promise<void>

Promise resolving once the save completes


unassign()

unassign(): Promise<OperationResponse<TaskAssignmentResponse[] | { taskId: number; }[]>>

Unassigns this task (removes current assignee)

Returns

Promise<OperationResponse<TaskAssignmentResponse[] | { taskId: number; }[]>>

Promise resolving to task assignment results