LogoLogo
GitHub
  • Elsa Workflows 3
  • Getting Started
    • Concepts
      • Outcomes
      • Correlation ID
    • Hello World
    • Prerequisites
    • Packages
    • Containers
      • Docker
      • Docker Compose
        • Elsa Server + Studio
        • Elsa Server + Studio - Single Image
        • Persistent Database
        • Traefik
  • Application Types
    • Elsa Server
    • Elsa Studio
    • Elsa Server + Studio (WASM)
  • Guides
    • HTTP Workflows
      • Programmatic
      • Designer
    • External Application Interaction
    • Loading Workflows from JSON
    • Running Workflows
      • Using Elsa Studio
      • Using a Trigger
      • Dispatch Workflow Activity
  • Activities
    • Control Flow
      • Decision
    • MassTransit
      • Tutorial
  • Expressions
    • C#
    • JavaScript
    • Python
    • Liquid
  • Extensibility
    • Custom Activities
  • Reusable Triggers (3.5-preview)
  • Multitenancy
    • Introduction
    • Setup
  • Operate
    • Variables
    • Activation Strategies
    • Incidents
      • Strategies
      • Configuration
    • Alterations
      • Alteration Plans
        • REST API
      • Applying Alterations
        • REST API
        • Extensibility
  • Optimize
    • Log Persistence
    • Retention
  • Hosting
    • Distributed Hosting
Powered by GitBook
On this page
  • Installing the Liquid Feature
  • Configuration
  • Filters, Tags and Objects
  • Filters
  • Objects
Edit on GitHub
  1. Expressions

Liquid

PreviousPythonNextCustom Activities

Last updated 4 months ago

When working with Elsa, you'll often want to write dynamic expressions. This page provides a glossary of various filters and tags you can use, in addition to the standard set that you can find in the .

Elsa uses the to implement Liquid. More tags and filters can be found there, as well as details on providing your own tags and filters.

Installing the Liquid Feature

The Liquid Expressions feature is provided by the following package:

dotnet package add Elsa.Liquid

You can enable the feature as follows:

Program.cs
services.AddElsa(elsa =>
{
   elsa.UseLiquid();
});

Configuration

The UseLiquid extension provides an overload that accepts a delegate that lets you configure the LiquidFeature, which itself exposes a delegate to configure FluidOptions.

For example:

Program.cs
services.AddElsa(elsa =>
{
   elsa.UseLiquid(liquid =>
   {
      liquid.FluidOptionstions += options =>
      {
         options.Encoder = HtmlEncoder.Default;
      }
   });
});

Filters, Tags and Objects

The following filters, tags and objects are available to Liquid expressions:

Filters

json

The json filter serialises an input value to a JSON string. Example:

{{ some_value | json }}

base64

The base64 filter converts an input value into a base64 string. Example:

{{ some_value | base64 }}

Objects

Variables

The Variables object provides access to the workflow variables. For example, if your workflow has a variable called OrderId, you can get that workflow variable using the following Liquid expression:

{{ Variables.OrderId }}

Input

The Input object provides access to workflow input. Example:

{{ Input.OrderNumber }}

WorkflowInstanceId

The WorkflowInstanceId object provides access to the workflow instance ID of the currently executing workflow. Example:

{{ WorkflowInstanceId }}

WorkflowDefinitionId

The WorkflowDefinitionId object provides access to the workflow definition ID of the currently executing workflow. Example:

{{ WorkflowDefinitionId }}

WorkflowDefinitionVersionId

The WorkflowDefinitionVersionId object provides access to the workflow definition version ID of the currently executing workflow. Example:

{{ WorkflowDefinitionVersionId }}

WorkflowDefinitionVersion

The WorkflowDefinitionVersion object provides access to the workflow definition version of the currently executing workflow. Example:

{{ WorkflowDefinitionVersion }}

CorrelationId

The CorrelationId object provides access to the correlation ID of the currently executing workflow. Example:

{{ CorrelationId }}

You can find more filters, tags and variables in the .

Liquid documentation
Fluid library
Filters
json
base64
Objects
Variables
Input
WorkflowInstanceId
WorkflowDefinitionId
WorkflowDefinitionVersionId
WorkflowDefinitionVersion
CorrelationId
Liquid documentation