Skip to main content

Workflow Handles

A workflow handle represents the state of a particular active or completed workflow execution. A workflow handle is obtained when a handler starts a workflow with handlerCtxt.startWorkflow or a workflow starts a child workflow with workflowCtxt.startWorkflow. Additionally, a handler or workflow can retrieve a workflow handle by calling ctxt.retrieveWorkflow with the workflow's identity UUID.


Methods

getStatus(): Promise<WorkflowStatus>

Retrieves the status of a workflow with the following structure:

export interface WorkflowStatus {
readonly status: string; // The status of the workflow. One of PENDING, SUCCESS, ERROR, RETRIES_EXCEEDED, or CANCELLED.
readonly workflowName: string; // The name of the workflow function.
readonly authenticatedUser: string; // The user who ran the workflow. Empty string if not set.
readonly assumedRole: string; // The role used to run this workflow. Empty string if authorization is not required.
readonly authenticatedRoles: string[]; // All roles the authenticated user has, if any.
readonly request: HTTPRequest; // The parent request for this workflow, if any.
}

getResult(): Promise<R>

Waits for the workflow to complete then returns its output.

getWorkflowUUID(): string

Retrieves the workflow's identity UUID, a string that uniquely identifies this workflow's execution.

getWorkflowInputs<T extends any []>(): Promise<T>

Retrieves the worklow's input argument array.