Advanced Dynamic Content – If Statements

NOTE: This is an update to an earlier post on the same topic. Do you want to create an email that displays different content based on a field in the recipient’s contact record? You can do that with FreeMarker. We’ve shown how to use FreeMarker in a previous post, and this post will go into more advanced details. Our previous post covers situations when the fields you are referencing will contain data for all recipients. While it would be best if everyone had all of their information filled in, that’s just not always the case. When one of the fields you are referencing does not contain data, the email will not be sent to that person at all. In this post, we will solve that problem by using variables in FreeMarker. We will continue with a similar scenario of referencing the language and gender fields in a contact record. Here’s what the logic looks like: If the recipient speaks Spanish… If the recipient is male… Content for male Spanish speakers goes here If the recipient is female… Content for female Spanish speakers goes here If the recipient’s gender is not set Content for unknown gender Content for all Spanish speakers goes here If the recipient speaks English, another language, or does not have a language set… If the recipient is male… Content for male English speakers goes here If the recipient is female… Content for female English speakers goes here If the recipient’s gender is not set Content for unknown…
Read More: Advanced Dynamic Content – If Statements