Skip to content

getWorkflowStaticData(type)#

This gives access to the static Pathway data.

Experimental feature

Static data isn't available when testing pathways. The Pathway must be active and called by a trigger or webhook to save static data.

You can save data directly in the workflow. This data should be small.

As an example: you can save a timestamp of the last item processed from an RSS feed or database. It will always return an object. Properties can then read, delete or set on that object. When the Pathway execution succeeds, Ensemble checks automatically if the data has changed and saves it, if necessary.

There are two types of static data, "global" and "node". Global static data is the same in the whole workflow. Every node in the Pathway can access it. The node static data is unique to the node. Only the node that set it can retrieve it again.

Example with global data:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Get the global Pathway static data
const workflowStaticData = $getWorkflowStaticData('global');

// Access its data
const lastExecution = workflowStaticData.lastExecution;

// Update its data
workflowStaticData.lastExecution = new Date().getTime();

// Delete data
delete workflowStaticData.lastExecution;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Get the global Pathway static data
workflowStaticData = _getWorkflowStaticData('global')

# Access its data
lastExecution = workflowStaticData.lastExecution

# Update its data
workflowStaticData.lastExecution = new Date().getTime()

# Delete data
delete workflowStaticData.lastExecution

Example with node data:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Get the static data of the node
const nodeStaticData = $getWorkflowStaticData('node');

// Access its data
const lastExecution = nodeStaticData.lastExecution;

// Update its data
nodeStaticData.lastExecution = new Date().getTime();

// Delete data
delete nodeStaticData.lastExecution;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Get the static data of the node
nodeStaticData = _getWorkflowStaticData('node')

# Access its data
lastExecution = nodeStaticData.lastExecution

# Update its data
nodeStaticData.lastExecution = new Date().getTime()

# Delete data
delete nodeStaticData.lastExecution