Context Data and Actions

Storing and Accessing JSON Data in Context within the Liberate Platform

The Liberate platform offers a robust mechanism for storing and accessing JSON data within the workflow context. This developer documentation provides an overview of how JSON data is stored and accessed in context, highlighting important concepts and usage patterns.

In the Liberate platform, context data plays a crucial role in passing information between workflow components and maintaining the state of execution. Context data can be initialized at the start of a workflow or written into context during the workflow execution.

Starting Workflows with Context Data

When starting a workflow, you can provide initial context data. This data is automatically written into the context by the platform and becomes available for subsequent components within the workflow. Please see Calling Workflow with Context Data

Writing Data from Component Results into Context

Data returned by various components, such as tasks, events, decision tables, and intermediate events, needs to be explicitly written into context using an action. By specifying an action on a component, you can namespace the data and define where it should be stored in the current context.

Accessing Data in Context

To access data returned by a component, you can use the pattern $.actionName.{jsonobject}. The $.actionName represents the specific action on the component, allowing you to namespace the data within the context. You can further specify the desired JSON object within the data using dot notation.

Accessing Context Data for Conditionals

When accessing data from a component immediately followed by a conditional, you can use $.data.{jsonobject} to access the data returned by the component.

However, for subsequent conditionals, you should use $.context.{jsonobject} to access the data stored in the workflow context.

Here is an example of saving the response/output from a Create Claim workflow instance into an Action of claimResponse

Then the expression using that action later in a request transformation to our email connection

{
    "type": "confirmation",
    "invoice": "$.processedInvoiceData.response",
    "policy": "$.policy",
    "pets": "$.pets",
    "claimNumber": "$.claimResponse.claimNumber"
}