Search.../

updateWorkflowFields( )

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

Updates an existing workflow.

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

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

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 updateWorkflowFields(workflowId: string, workflowInfo: UpdateWorkflowRequest): Promise<void>

updateWorkflowFields Parameters

NAME
TYPE
DESCRIPTION
workflowId
string

ID of the workflow to update.

workflowInfo
UpdateWorkflowRequest

Workflow information to update.

Returns

Fulfilled - When the workflow has been updated.

Return Type:

Promise<void>

Was this helpful?

Update a workflow

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { workflows } from 'wix-crm-backend';
3
4/* Sample workflowId value: "c6dea502-1dd0-405f-906f-dcb9776e37e8"
5 *
6 * Sample workflowInfo value:
7 * {
8 * "name": "New name"
9 * }
10 */
11
12export const myUpdateWorkflowFunction = webMethod(Permissions.Anyone, async (workflowId, workflowInfo) => {
13 try {
14 const updatedWorkflow = await workflows.updateWorkflowFields(workflowId, workflowInfo);
15
16 console.log('Success! Updated workflow:', updatedWorkflow);
17 return updatedWorkflow;
18 } catch (error) {
19 console.error(error);
20 }
21});
22
23// Returns a promise that resolves to void.