Liquid Primer

The following Liquid expressions are supported in World of Workflows:

Common Variables

Workflow Variables

Use the following syntax to access a workflow variable:


{{ Variables.NameOfVariable }}

For example, given a workflow variable called FIRSTNAME with a value of “Alice”, the expression


Hello {{ Variables.FirstName }}.

will result in Hello Alice,

Input

Input values can be accessed using the following syntax:


{{ Input }}

Activity Output

To access a named activity’s output, use the following syntax:


{{ Activities.SomeActivityName.Output }}

CorrelationId

Returns the correlation ID (if any) of the currently executing workflow.


{{ CorrelationId }}

WorkflowInstanceId

Returns the workflow instance ID of the currently executing workflow.


{{ WorkflowInstanceId }}

WorkflowDefinitionId

Returns the workflow definition ID of the currently executing workflow.


{{ WorkflowDefinitionId }}

WorkflowDefinitionVersion

Returns the workflow definition version of the currently executing workflow.


{{ WorkflowDefinitionVersion }}

Configuration

Provides access to a .NET configuration value. See Configuration for more details on available configuration items in World of Workflows.


{{ Configuration.SomeSection }}

As an example, let’s say you have the following JSON in appsettings.json:

{
  "Elsa": {
    "Smtp": {
      "Host": "localhost",
      "Port": 2525
    }
  }
}

You can access the configured Port value using the following expression:


{{ Configuration.Elsa.Smtp.Port }}

Common Filters

| json

json is a liquid filter that renders the specified value as a JSON string.


{{ Input | json }}

Example output:

{
  "SomeDocument": {
    "Title": "About Elsa Workflows"
  }
}

| base64

A liquid filter that renders the specified value as a bas64 representation. The value is first converted to a string. If the value is an object, array, dictionary or datetime, it is first serialized using JsonConvert.SerializeObject before being encoded as base64.


{{ "Some string value" | base64 }}

Example output:
U29tZSBzdHJpbmcgdmFsdWU=

Workflow Filters

| workflow_definition_id

workflow_definition_id translates the specified workflow name or workflow tag into a workflow ID. This is useful for activities such as RUNWORKFLOW which require a workflow ID to run.

Usage:


{{ "SomeWorkflowName" | workflow_definition_id }}


{{ "SomeWorkflowTag" | workflow_definition_id: tag }}

HTTP Variables

| request

request provides access to various properties on the current HTTP Request object:


{{ Request.QueryString }} 
{{ Request.ContentType }} 
{{ Request.ContentLength }} 
{{ Request.Form }} 
{{ Request.Protocol }} 
{{ Request.Path }} 
{{ Request.PathBase }} 
{{ Request.Host }} 
{{ Request.IsHttps }} 
{{ Request.Scheme }} 
{{ Request.Method }}

HTTP Filters

| signal_url

signal_url is a liquid filter that generates a fully-qualified absolute signal URL that will trigger the workflow instance from which this function is invoked.

Example:


{{ "MySignal" | signal_url }}

Example output: ` https://localhost:5001/signals/trigger/{some base64 token} `

| markup

markup is a liquid filter which provides the text as full html rather and htmlencoded data


{{“<h1>Hello</h1>” | markup }}

Example output:

# Hello

Copyright © 2023-2024 World of Workflows.