Search.../

createPhase( )

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 phase.

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

Pass a value for the position parameter to specify the newly created phase's position within the specified workflow. Positions are zero-based, meaning the first position is 0. When omitted, the newly created phase is added as the last non-win phase.

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

Syntax

function createPhase(workflowId: string, phaseInfo: CreatePhaseRequest, [position: number]): Promise<string>

createPhase Parameters

NAME
TYPE
DESCRIPTION
workflowId
string

ID of the workflow to add the new phase to.

phaseInfo
CreatePhaseRequest

Phase to create.

position
Optional
number

The created phase's position within the workflow.

Returns

Fulfilled - ID of the newly created phase.

Return Type:

Promise<string>

Was this helpful?

Create a phase

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