Deletes a task by ID.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function deleteTask(taskId: string): Promise<void>;
ID of the task to delete.
import { tasks } from "wix-crm.v2";
/* Sample taskId value:
* '3194f3f2-945f-4810-8905-d02b24f9e790'
*/
export async function myDeleteTaskFunction(taskId) {
try {
await tasks.deleteTask(taskId);
console.log("Task deleted.");
} catch (error) {
console.log(error);
//Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.