Search.../

createCard( )

Deprecated. This function is being discontinued in the upcoming months. We are working to provide alternatives, and we'll provide timely updates before implementing any changes. We understand that this transition might present challenges, and we appreciate your patience and understanding.

Description

Creates a new workflow card.

The createCard() function returns a Promise that resolves to the created card's ID when the card is created in the specified workflow phase.

Pass a value for the position parameter to specify the newly created card's position within the specified phase. Positions are zero-based, meaning the first position is0. When omitted, the newly created card is added to the specified phase as the top card within the phase.

This function requires you to specify the ID of a workflow and phase. To learn about retrieving IDs in the Workflow API, see Retrieving IDs.

Note: Each workflow is limited to 5,000 cards. If this limit is reached, createCard() throws an error. Archive cards when they're no longer needed to reduce card count and avoid hitting the limit.

Syntax

function createCard(workflowId: string, phaseId: string, card: CreateCardRequest, [position: number]): Promise<string>

createCard Parameters

NAME
TYPE
DESCRIPTION
workflowId
string

ID of the workflow to create the card in.

phaseId
string

ID of the phase to create the card in.

card
CreateCardRequest

Card to create.

position
Optional
number

The created card's position within the workflow.

Returns

Fulfilled - ID of the newly created card.

Return Type:

Promise<string>

Was this helpful?

Create a card

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { workflows } from 'wix-crm-backend';
3
4export const createCard = webMethod(Permissions.Anyone, (workflowId, phaseId, contactId, position = undefined) => {
5 return workflows.createCard(
6 workflowId,
7 phaseId,
8 {
9 "name": "Card Name",
10 "contactId": contactId
11 },
12 position
13 );
14});
15
16// Returns a promise that resolves to:
17// "3c9683ea-f6cc-470b-b0d1-2eb6b8cea912"