getTask( )
Deprecated. This function will continue to work, but a newer version is available at wix-crm.v2.Tasks.getTask().
Description
Migration Instructions
If this function is already in your code, it will continue to work. To stay compatible with future changes, migrate to
wix-crm.v2.Tasks.getTask()
.To migrate to the new function:
Add the new import statement:
javascript | Copy Codeimport { tasks } from 'wix-crm.v2'If you plan to migrate all functions that use
wixCrmBackend
, remove the originalimport wixCrmBackend
statement.Look for any code that uses
wixCrmBackend.tasks.getTask()
, and replace it with withtasks.getTask()
. Update your code to work with the newgetTask()
call and response properties.Test your changes to make sure your code behaves as expected.
Gets a task by ID.
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
The ID of the task to get from the task list.
Returns
Fulfilled - The task with the given ID.
Return Type:
NAME
TYPE
DESCRIPTION
Unique task identifier.
Task title.
Date the task is due.
Unique identifier of the site contact that this task is linked to.
Indicates whether the task has been completed.
Running task version number. Each time an action is performed on a task its version number is incremented.
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.
When creatorType
is "USER"
, the unique
identifier of the user that created the task in the dashboard. Otherwise, userId
is not
present.
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
1import { Permissions, webMethod } from 'wix-web-module';2import { tasks } from 'wix-crm-backend';34export const getTask = webMethod(Permissions.Anyone, (taskId) => {5 return tasks.getTask(taskId);6});78/* Returns a promise that resolves to:9 * {10 * "_id": "6cb91509-7aa1-479b-a242-7327f58b7157",11 * "title": "Add domain",12 * "version": 9,13 * "dueDate": "2019-01-22T10:00:00Z",14 * "contactId": "6cb91509-7aa1-479b-a242-7327f58b7157",15 * "isCompleted": false,16 * "applicationId: "791f5e4f-5377-47a9-bd8e-cc0ef4605c8f",17 * "creatorType": "APP"18 * }19 */