Search.../

listPhases( )

Retrieves a list of a workflow's phases.

Description

The listPhases() function returns a Promise that resolves to a list containing information about the specified workflow's phases.

Use the options parameter to specify which phases to retrieve and in which order to retrieve them. Phases can be sorted based on their "id", "name", and "position". If no limit parameter is passed, the first 50 cards are returned. Sort order defaults to by "position" ascending.

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

This function is not a universal function and runs only on the backend.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function listPhases(workflowId: string, options: ListPhasesOptions): Promise<ListPhasesResponse>

listPhases Parameters

NAME
TYPE
DESCRIPTION
workflowId
string

ID of the workflow whose phases will be listed.

options
Optional
ListPhasesOptions

Options to use when retrieving the list of workflow phases.

Returns

Return Type:

Promise<
ListPhasesResponse
>
NAME
TYPE
DESCRIPTION
pagination
PaginationResponse

Metadata for the page of results.

phases
Array<
Phase
>

List of phases.

Was this helpful?

listPhases example

Copy Code
1import { phases } from 'wix-workflows.v2';
2
3 async function listPhases(workflowId, options) {
4 try {
5 const result = await phases.listPhases(workflowId, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13