Deprecated. This function will continue to work, but a newer version is available at wix-crm.v2.Tasks.createTask().
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.createTask()
.
To migrate to the new function:
Add the new import statement:
import { tasks } from "wix-crm.v2";
If you plan to migrate all functions that use wixCrmBackend
,
remove the original import wixCrmBackend
statement.
Look for any code that uses wixCrmBackend.tasks.createTask()
,
and replace it with with tasks.createTask()
.
Update your code to work with the new createTask()
call and response properties.
Test your changes to make sure your code behaves as expected.
Creates a new task.
The createTask()
function returns a Promise that resolves to the ID of the
the newly created task after it has been successfully created.
When creating a new task, the specified TaskInfo
object must
contain a title
value.
function createTask(taskInfo: TaskInfo): Promise<string>;
The information to use when creating the task.
import { Permissions, webMethod } from "wix-web-module";
import { tasks } from "wix-crm-backend";
export const createTask = webMethod(
Permissions.Anyone,
(title, contactId, dueDate) => {
const taskInfo = {
title: title,
contactId: contactId,
dueDate: dueDate,
};
return tasks.createTask(taskInfo);
},
);
// Returns promise that resolves to:
// 3c9683ea-f6cc-470b-b0d1-2eb6b8cea912
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.