An updated version of this post can be found here

Recently we had a prospect (now customer J ) that wanted to have standard email templates which could bring in data from standard and custom entities. But there was a twist; they also wanted to be able to bring in multiple records for some entities. Here is the scenario: the customer is in the home building industry and they wanted to have a standard template which could contain information about the recipient the template was being sent to as well as information about a specific subdivision and various homes in that subdivision.

A simplified version of the email template in question is pictured below. This could easily be complex HTML with graphics and formatting but we are using this example for simplicity. You can see that in line 1 it brings in the recipient's (contact) full name. Then, in the next line it brings in the name of a subdivision (a custom entity) and then a table with information about that subdivision. Below that the email template will include information about one or more homes records. This is achieved by using the Freemarker list directive. Freemarker is an open source template markup language that the ClickDimensions email engine employees for complex dynamic content capability.

The data fields in the template can come from any custom or standard field or entity in CRM. You add fields by simply using the same syntax that our standard data fields use. For example, ${Recipient.lead.firstname[0]!""} represents the first name field on the lead record. Following this syntax we can include any data in the template. For example, if you have a custom entity named new_subdivision with a field named new_name you can place the data field ${Recipient.new_subdivision.new_name} into your template (note that the characters [0]!"" at the end of the lead first name field are optional).

Below is what the custom subdivision entity looks like. Note that it has paths to images of the subdivision. Note that it also has home records linked to it (Home is also a custom entity).

Below is what the Home custom entity looks like. It also has paths to image files…

Now that the Email Template is ready we need a way to specify which subdivision and which homes should be merged into the template. We do this by using the CRM connections feature. We simply link a subdivision and one or more home records to the ClickDimensions Email Send record using the standard CRM connections functionality on the Email Send record. In the case of our subdivisions/homes example we will link a subdivision record to the ClickDimensions Email Send record…

And then we will link any number of homes records to the ClickDimensions Email Send record. The result is that we have one subdivision and several homes records linked to the Email Send record…

Of course, the Email Template we showed above is also linked to the ClickDimensions Email Send record…

Now we just add some recipients (Leads, Contacts, Accounts and/or Marketing Lists in any combination) and when we send our email all the data from the recipient, subdivision and homes records is merged into the resulting email. Again, this was not meant to be a fancy email but we could just as easily have formatted it any way we wanted.

This has been a complex example but hopefully you are seeing the power of our merging capability as well as the advantages we have by enabling dynamic content through the Freemarker language. Happy marketing!