Workflow

Workflow helper library.

Static properties

instanceId string

The current workflow instance id.

instance WorkflowInstance

The current workflow instance information.

signal any

Signal data.

signalObject { [key: string]: any; }

Signal data as an object. If the signal data is not an object, this will be null.

tags { [key: string]: any; }

Metric tags to override the default tags for the generated alerts.

Methods

getInstanceId

Get the current workflow instance id.

Parameters

Return type

string

Examples

createSignalUrl

Create a signal url.

Parameters

nextStep string

The ID or name of the next step.

token any

The token or signal data.

title string

(optional) The title of the signal.

Return type

string

Examples

createNextSignalUrl

Create a signal url using the configured next step.

Parameters

token any

The token or signal data.

title string

(optional) The title of the signal.

Return type

string

Examples

sendHubSignal

Send a signal to all Hub clients connected to the workflow instance.

Parameters

name string

The name of the signal.

data { [key: string]: any; }

The data to send.

Return type

void

Examples

queue

Queue another workflow ruleset to start.

Parameters

name string

The name of the workflow ruleset.

version string

The version of the workflow ruleset.

input { [key: string]: any; }

The input data for the workflow.

options { [key: string]: any; }

(optional) The options for the workflow.

tags string[]

(optional) The tags for the workflow.

Return type

void

queueLibrary

Queue another workflow library ruleset to start.

Parameters

library function

The library that is a workflow ruleset.

input { [key: string]: any; }

The input data for the workflow.

options { [key: string]: any; }

(optional) The options for the workflow.

tags string[]

(optional) The tags for the workflow.

Return type

void

getDocuments

Get documents from the database.

Parameters

Return type

WorkflowDocument[]

getDocument

Get a document from the database.

Parameters

documentTypeName string

The name of the document type. Should match one defined under the 'Document Types' section of the workflow Settings.

Return type

WorkflowDocument

getDocumentDataUri

Get a document from the database as a data URI.

Parameters

documentTypeName string

The name of the document type. Should match one defined under the 'Document Types' section of the workflow Settings.

Return type

string

saveDocument

Save a document to the database.

Parameters

documentTypeName string

The name of the document type. Should match one defined under the 'Document Types' section of the workflow Settings.

dataUri string

The Base64 data URI of the document.

fileName string

(optional) The name of the file.

Return type

void

Examples

setProgress

Set the progress of the workflow.

Parameters

completed number

The number of completed items.

total number

The total number of items.

Return type

void

setStage

Set the custom stage of the workflow.

Parameters

stage string

The custom stage of the workflow.

Return type

void

Examples

setName

Set the name of the workflow instance.

Parameters

name string

The name of the workflow instance.

Return type

void

stop

Stop the workflow gracefully. State changes will be saved.

Parameters

message string

(optional) The message to log.

Return type

void

getPreviousAlerts

Get the previous alerts for the current step. These are the alerts that were by the direct previous step(s).

Parameters

Return type

Alert[]

clearAlerts

Clear all alerts from the workflow instance.

Parameters

Return type

void