Search.../

getWorkflow( )

Retrieves a workflow by ID.

Description

The getWorkflow() function returns a Promise that resolves to the workflow info with the specified ID.

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 getWorkflow(_id: string, cardsPerPhase: number): Promise<GetWorkflowResponse>

getWorkflow Parameters

NAME
TYPE
DESCRIPTION
_id
string

ID of the workflow to retrieve.

cardsPerPhase
number

Maximum number of cards to return per phase. To retrieve additional pages of cards, use List Cards (in the Cards API).

Returns

Return Type:

Promise<
GetWorkflowResponse
>
NAME
TYPE
DESCRIPTION
workflow
Workflow

Requested workflow.

Was this helpful?

getWorkflow example

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