Form Autoresponder Text Injected using Liquid

It is possible using Liquid to change the Autoresponder text based on the selection that a customer made through a form?

For example there was a dropdown or checkbox field where the customer could choose that they are interested in ‘Service A’, ‘Service B’ or ‘Service C’, can we have information about that particular service injected into the Autoresponder email?

If I understand it correctly I am quite sure that is possible. I have made a test a long time ago like this:

{% if formSubmissionData.fields.system.firstname.value == "Test" -%}
Your name is Test
{% else -%}
Your name is NOT Test
{% endif -%}

You should be able to do this with any field in the form :slight_smile:

I hope that was what you were looking for :slight_smile:

That is exactly what I am after Peter! I will test it out and see how it goes. Thank you :tada:

@Peter-Schmidt I am trying to use liquid in my autoresponder and it is for a dropdown list called ‘Service’. I have tried using both of these codes but it still doesn’t seem to work -
{% if formSubmissionData.fields.service.value == “First Home Buyer” -%}
{% if formSubmissionData.fields.system.service.value == “First Home Buyer” -%}
Any idea what I am doing wrong???
Do I need to add some liquid code to the top of the form to pull in all the form data?

Hi @SiroccoDigital since this is not a system field you’ll need to replace system with all.
So:
{% if formSubmissionData.fields.all.service.value == "First Home Buyer" -%}

https://docs.treepl.co/documentation_group/liquid/formsubmissiondata-object

So I am using {% if formSubmissionData.fields.all.service.value == “First Home Buyer” -%} This is the data {% endif -%} in the autoresponder email but it is not displaying the content. The form field is called ‘Service’ and it is a dropdown list. Any idea what could be causing this?

Is “First Home Buyer” the exact value of that field?
Try just outputting {{formSubmissionData.fields.all.service.value}} to see what the value looks like.

Yes it is. I have setup an if statement setup in the autoresponder for each answer from that dropdown field.

Oh, you may need to but this at the start:

{% if this.formSubmissionData.fields.all.service.value == “First Home Buyer” %} 

{{formSubmissionData.fields.all.service.value}} doesn’t provide any information in the email autoresponder.

I have also trialled -
{% if formSubmissionData.fields.servicer.value == “First Home Buyer” -%} TBC {% endif -%}
But it still doesn’t work…

Add this. to the start as per my previous comment (you may have missed that one) and see if that fixes it.

The {% if this.formSubmissionData.fields.all.service.value == “First Home Buyer” -%} doesn’t work either.

Ok, actually did a test and can see the correct data structure now :slight_smile:

{% if this.formSubmissionData.fields.custom.service.value == “First Home Buyer” -%} 

(note the custom path in place of all)

TIP:
If you’re trying to find out a particular data path always output the whole set in the layout you’re working in like:

<pre>{{this.formSubmissionData}}</pre>

and that will show you everything available and where it’s located in the data tree.

1 Like

As @Adam.Wilson mentioned <pre>{{this.formSubmissionData}}</pre> is a great tool for seeing which data is available. You can use this everywhere, for example if you are outputting a custom module to a collection.

For example if you do something like this for a custom module called “test”.
{% component source: “test”, layout: “”, collectionVariable: “testCollection”, type: “module” %}

You would be able to output everything like so:

<pre>{{testCollection}}</pre>

I have managed to get all the data to come through in the form using your code example and the form field that I’m trying to target displays like this -
“Custom”: {
“Service”: {
“Id”: “Service”,
“Name”: “Service”,
“Value”: “SMSF Loan”
},

But I still can’t get it to display content I want by adding this type of liquid code -
{% if this.formSubmissionData.fields.all.service.value == “SMSF Loan” -%}

Text Here

{% endif -%}

Hi @SiroccoDigital :slight_smile:

Have you tried this?
{% if formSubmissionData.fields.custom.service.value == “SMSF Loan” -%}

I can get a custom value on the form submission page like so:

{{formSubmissionData.fields.custom.NAME-OF-CUSTOM-FIELD.value}}

You nailed it @Adam.Wilson! Well at least we now know all the ways it doesn’t work too :wink: