Search.../

onCardCreated( )

An event that fires when a new workflow card is created.

Description

The onCardCreated() event handler runs when a new workflow card is created programmatically using the createCard() function or manually in your site's Dashboard. The received CardCreatedEvent object contains information about the card that was created.

Note: Backend events don't work when previewing your site.

Syntax

function onCardCreated(event: CardCreatedEvent): void

onCardCreated Parameters

NAME
TYPE
DESCRIPTION
event

CardCreatedEvent

The created card's data.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event when a card is created

Code Example

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3
4export function wixCrm_onCardCreated(event) {
5 let workflowId = event.workflowId;
6 let cardName = event.card.name;
7}
8
9/* Full event object:
10 * {
11 * "workflowId": "f2cb00b5-9286-4d35-b41b-367d6fec43ce",
12 * "workflowName": "My Workflow",
13 * "phaseId": "ngp4030h-no3q-038h-c390-of40dn28pc9e",
14 * "phaseName": "To-do",
15 * "card": {
16 * "name": "This is a card.",
17 * "source": "Contacts",
18 * "id": "gd83brj9-34n8-ce8h-fh08-4e90cni3df89",
19 * "contactId": "ej8994ed-h3e9-uh2w-fhu0-vj013in3cej8",
20 * "createdAt": 2019-03-13T00:00:00.000Z,
21 * "updatedAt": 2019-06-12T00:00:00.000Z
22 * }
23 * }
24 */