completeTask( )


Deprecated. This function is deprecated but will continue to work. To set a task as completed, see the wix-crm.v2.Tasks.updateTask() function.

  • 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.updateTask().

To migrate to the new function:

  1. Add the new import statement:

    Copy
    import { tasks } from "wix-crm.v2";
  2. If you plan to migrate all functions that use wixCrmBackend, remove the original import wixCrmBackend statement.

  3. Look for any code that uses wixCrmBackend.tasks.removeTask(), and replace it with with tasks.updateTask(). To set the task as completed, set the status field to "COMPLETED".

  4. Test your changes to make sure your code behaves as expected.

Sets a task as completed.

The completeTask() function returns a Promise that resolves to the ID of the the task after it is set as completed.

Method Declaration
Copy
function completeTask(taskId: string): Promise<string>;
Method Parameters
taskIdstringRequired

ID of the task to set as complete.

Returns
Return Type:Promise<string>
Set a task as completed
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { tasks } from "wix-crm-backend"; export const completeTask = webMethod(Permissions.Anyone, (taskId) => { return tasks.completeTask(taskId); }); // Returns a promise that resolves to: // "3c9683ea-f6cc-470b-b0d1-2eb6b8cea912"
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?