Search.../

updatePhase( )

Updates an existing workflow phase.

Description

The updatePhase() function returns a Promise that resolves when the phase has been updated with the specified values.

Only the properties passed in the phase object will be updated. All other properties will remain the same.

This function requires you to specify the ID of a phase. 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 updatePhase(_id: string, phase: PhaseInfo): Promise<void>

updatePhase Parameters

NAME
TYPE
DESCRIPTION
_id
string

ID of the phase to update.

phase
PhaseInfo

Phase details to update.

Returns

Return Type:

Promise<
void
>

Was this helpful?

updatePhase example

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