Skip to main content
All CollectionsWorkflowsAction Guides
Action: Format Output with Liquid
Action: Format Output with Liquid
Updated over a month ago

Overview

The Format Output with Liquid action allows you to combine and format data from previous steps in your workflow using the powerful Liquid templating language. You can pull in data points, manipulate them, and structure them into the exact format you need.

The action provides a flexible way to map data fields from your workflow as Liquid variables, and then reference those variables in a Liquid template where you define how the data should be laid out and formatted. Format Output with Liquid supports Liquid's full range of capabilities, allowing you to incorporate dynamic logic, loops, filters and more to precisely shape your data.

Usage Examples

  • Extracting a piece of text from a structured output - pass a JSON object through as a liquid variable and then reference a specific property.

    • For example: {{ product.title }}

  • Looping through an array of text - use Liquid’s iteration capabilities to loop through an array and format the values in a useful way.

    • For example:

      {% for product in collection.products %} {{ product.title }} {% endfor %}

Inputs

  • Data - A set of data elements to make available to your Liquid template, mapped as key-value pairs. The key will be the Liquid variable name used to reference that data in your template. The value is the actual data, drawn from previous steps of your workflow. You can include as many data elements as needed.

  • Liquid Template - A Liquid template that defines how your data elements should be structured and formatted into the final text output. Use Liquid variables, tags, and filters to layout and manipulate your data. The template will be rendered with the data you specified to generate the output text.

Outputs

The main output of the Format Output with Liquid action is a text string that merges your input data with your Liquid template. The action will render your template, pulling in the data elements you mapped as Liquid variables. The output text will reflect the structure, formatting, and any dynamic processing defined in your template.

This allows you to take raw data from anywhere in your workflow and transform it into any kind of text-based format you need. You can generate dynamic documents, webpages, emails, reports, or any other textual assets, all driven by your data and template definitions.

Tips

  • Use descriptive variable names - When mapping your data elements to Liquid variables, choose clear, descriptive names that will make your template easier to read and understand, like "recipient_first_name" or "document_title".

  • Take advantage of Liquid's features - Liquid provides a wide range of tags, filters and operators to customize your template. You can use conditionals to adapt your output based on the data, loops to iterate through arrays or lists, filters to modify strings and numbers, and much more. Refer to the Liquid documentation for details on its full capabilities

Did this answer your question?