{{ workflow }} object

This liquid object will output the Workflow details of a submitted Form.

You can use this on the default form submission page (/_form-submission-results/) or any custom redirect page you have setup for the confirmation page of your form.

The output can also be used within the forms auto-response email Body, From Name, and Subject fields, as well as the Workflow Notification email Body and Email Templates.

{{ this.workflow }}

An example of the data structure for a successfully submitted form is below.

{
    "id": 2,
    "name": "Inquiry Workflow",
    "recipients": [
        "sales@example.com"
    ]
}

Accessing the Data

As an example of rendering a piece of this data onto your confirmation page or within the forms autoresponder email you could use the following Liquid:

{{ this.workflow.name }}

This would output the value Inquiry Workflow to the page/email based on the above example data.

Extending on this example, we can use this data to inform the recipient of the type of Workflow being sent:

<p>You are assigned to the workflow '{{this.workflow.name}}' which is set up to notify the following recipients:<br>
{{this.workflow.recipients}}</p>

Viewing Data while Developing

It is often desirable to see all the data that is available to you on a page while developing your applications and there are two common techniques for doing this.

1. Rendering JSON to the Page

You can quickly and easily render the full JSON output directly to the page you are working on in order to view all the data and its structure in an easy to read format.
Simply wrap your desired Liquid object in <pre> tags like so; <pre>{{this.workflow}}</pre>

A JSON representation of the available data will be rendered to the page similar to the output examples above.

You can actually use this method to log any Liquid data to the console, such as a custom collection, for example: <pre>{{myCustomCollection}}</pre>

This of course is a temporary technique as you would not want to leave the JSON data visible on the page.

2. Rendering JSON to the Console

Perhaps a cleaner and more persistent way of viewing this data while in development, is to log the JSON output to your browser's console (in the browser's Developer Tools).

To do this, add some javascript code to your template file (just before the closing </body> tag) like this:

<script>
    console.log({{this.workflow}});
</script>

What this will do is output the JSON data into a structured data tree in your browser's Developer Tools console.

You can actually use this method to log any Liquid data to the console, such as a custom collection, for example:

<script>
    console.log({{myCustomCollection | strip_html}});
</script>

You might notice the Liquid filter | strip_html added here. This is optional, however, in some cases the JSON data will contain HTML code and this can break the Javascript, causing a scripting error.
So, keep in mind that, when using this filter, any fields containing HTML code in your JSON will not actually show the HTML in the console, however, the data is still there and accessible via Liquid when rendering to the page.

Remember to remove this code for production as it could pose a data security risk and it is best practice not to leave console logs in your scripts.



Related Articles

  • System Pages
    System Pages, under 'Settings', is where you’ll find all those pages required by certain system...
  • form
    This component outputs data relating to a specific Form. {% component type: "form", alias: "<form_alias>"...
  • Form Submissions
  • System Emails
    System emails are emails that are sent when a particular action is carried out on...
  • {{ formSubmissionData }} object
    This liquid object will output the submission details of a Form. You can use this...
  • {{ order }} object
    This liquid object will output the order details of a submitted Form. Currently, this object...
  • Forms
    Forms are an essential part of collecting user information on your website.Treepl CMS makes managing...
  • Secure Zones
    Secure Zones provide a way of creating restricted content on your website that only registered...
  • ReCaptcha Styling
    Treepl CMS supports Google reCAPTCHA v2 and v3 implementations. Below are some additional options you...

External Resources

There are currently no external resources available.

Please let us know if you have any other contributions or know of any helpful resources you'd like to see added here.


Questions?

We are always happy to help with any questions you may have.
Send us a message at support@treepl.co and we will consult you as soon as possible.