Search.../

getTask( )

Gets a task by ID.

Description

The getTask() function returns a Promise that resolves to the task with the given ID.

Syntax

function getTask(taskId: string): Promise<Task>

getTask Parameters

NAME
TYPE
DESCRIPTION
taskId
string

The ID of the task to get from the task list.

Returns

Fulfilled - The task with the given ID.

Return Type:

Promise<Task>
NAME
TYPE
DESCRIPTION
_id
string

Unique task identifier.

title
string

Task title.

dueDate
Date

Date the task is due.

contactId
string

Unique identifier of the site contact that this task is linked to.

isCompleted
boolean

Indicates whether the task has been completed.

version
number

Running task version number. Each time an action is performed on a task its version number is incremented.

creatorType
string

Type of the task's creator. "USER" if the task was created using the site's dashboard. "APP" if the task was created using the createTask() function or if it was created by an app installed on the site.

userId
string

When creatorType is "USER", the unique identifier of the user that created the task in the dashboard. Otherwise, userId is not present.

applicationId
string

When creatorType is "APP", the unique identifier of the application that created the task. Otherwise, applicationId is not present.

Was this helpful?

Get a task by ID

Copy Code
1import {tasks} from 'wix-crm-backend';
2
3export function getTask(taskId) {
4 return tasks.getTask(taskId);
5}
6
7/* Returns a promise that resolves to:
8 * {
9 * "_id": "6cb91509-7aa1-479b-a242-7327f58b7157",
10 * "title": "Add domain",
11 * "version": 9,
12 * "dueDate": "2019-01-22T10:00:00Z",
13 * "contactId": "6cb91509-7aa1-479b-a242-7327f58b7157",
14 * "isCompleted": false,
15 * "applicationId: "791f5e4f-5377-47a9-bd8e-cc0ef4605c8f",
16 * "creatorType": "APP"
17 * }
18 */