An event that triggers when a task is updated.
The onTaskUpdated()
event handler runs when a task is updated. The received TaskUpdated
object contains information about the task that was updated.
Note: Backend events don't work when previewing your site.
function wixCrmTasks_onTaskUpdated(event: TaskUpdated): void;
Information about the task that was updated and metadata for the event.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixCrmTasks_onTaskUpdated(event) {
const eventId = event.metadata.id;
const entityId = event.entity._id;
const title = event.entity.title;
console.log("Task updated", event);
}
/* Full event object:
* {
* "metadata": {
* "id": "ad02b9fa-ec28-48b8-b6f5-9921fbecd090",
* "entityId": "cdc52d55-e3e8-4fb4-8413-f15838e352b1",
* "eventTime": "2024-01-21T06:51:36.211546569Z",
* "triggeredByAnonymizeRequest": false
* },
* "entity": {
* "revision": "2",
* "title": "Update Contact",
* "description": "Add new label to sontact",
* "dueDate": "2024-03-15T00:00:00.000Z",
* "status": "COMPLETED",
* "source": {
* "sourceType": "APP",
* "appId": "151e476a-715e-ec33-db9a-a7ff4d51f70a"
* },
* "contact": {
* "firstName": "Julie",
* "lastName": "Jones",
* "email": "julie.jones@example.com",
* "phone": "+1 516-569-2772",
* "_id": "719784da-0361-4f86-b4a4-b38409d7bce1"
* },
* "_id": "cdc52d55-e3e8-4fb4-8413-f15838e352b1",
* "_createdDate": "2024-01-18T13:46:18.198Z",
* "_updatedDate": "2024-01-21T06:51:36.203Z"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.