Templates / Create a centralized data store

Create a centralized data store

Overview

Individuals or companies may want a way to centralize their data storage management within Tray (as per this blog post Tray created on LinkedIn).

The idea here is to create a workflow within a project that will essentially act as a data storage API for all the other workflows (within the same project).

Use cases include scenarios such as various project workflows needing access to a large batch of various URLs. Or various organisational workflows which need a "centralized database" containing different company contact email addresses.

Whenever a workflow in the team project needs specific data, it will be able to call on this "Data Storage API workflow" to GET or SET the values required.

By managing the keys or outputs in the parent workflow this workflow shows us how one might potentially share data amongst a group of workflows that are unique to a specific end-user.

This workflow takes the input of the action, the key, and the data that a parent workflow wants to use. It then performs the necessary actions to SET or GET said data from the provided key.

Finally it returns that value (or confirmation of saving that value) to the parent workflow. In the case that the operation is not a valid one, a notification of failure is sent back instead.

This "Data storage API workflow" is to be used for data that changes based on workflow executions.

If the data is always static and never changing then we recommend storing that value as a config property instead.

Connectors Used

The following connectors are used in this template.

This is mostly provided for reference only - there is no need to read through the linked connector pages. All you need to know for this template is explained here.

Though you will probably need to look up service authentication instructions if you don't already have them

End Result

The image below shows an example of the request/ response loop from the parent and child workflows.

ds-end-result

Prerequisites

This workflow assumes the following:

  • You should have a parent workflow that can be used in conjunction with the Data Storage connector

  • See Implementation notes below for more details.

Workflow Logic

The following screenshot illustrate the logic of the various workflow steps.

ds-man-logic

Getting Live

In order to configure this workflow for use simply follow the accordion steps below.

Implementation notes

You must have a Parent Workflow that can be used in conjunction with the data storage connector in order to use this template.

A simple 2 step workflow would suffice for testing purposes such as the one demonstrated below.

If you use this model please make sure you set the operation to Fire and wait for Response. If you do not do this, the workflow will not be presented within the dropdown options of available child workflows to use.

Also make sure to consider what values would be most similar to your personal use case.

Note that the Operation is case sensitive and you must use either GET or SET.

parent-props

Step-by-step breakdown

For educational purposes, the rest of this page will take you through how the workflow template is built to achieve the desired results. This will help deepen your understanding of Tray.io and will give you the power to maintain and edit your workflow as necessary.

Section 1: Get payload and select Branch

Section 2: GET branch

Section 3: SET branch

Section 4: Error handling