Note: This is an updated version of an older post, which can be found here.

Recently we had a customer that wanted to have standard email templates that 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 that 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 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 one of the email, the template 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 home records. This is achieved by using the FreeMarker list directive. FreeMarker is an open source template markup language that the ClickDimensions email engine uses for complex dynamic content.

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 used to specify placeholder text and are optional).

New homes email template

Below is what the custom subdivision entity looks like. Prior to the email being sent out, our images appear as broken links because the source path for the file is being handled by FreeMarker as well. Once the email goes out, the source path will be dynamically pulled from the relevant subdivision or home record and display the appropriate image. Note that it also has home records linked to it (home is also a custom entity).

This is what our subdivision entity looks like in CRM. Relevant homes are connected to the subdivision and accessible through the related menu, and the aforementioned images can be seen at the bottom of the record.

Subdivision record

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

Home Record

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.

Subdivision lookup

Then we will link any number of home records to the ClickDimensions email send record. The result is that we have one subdivision and several home records linked to the email send record.

New homes email send connections

Of course, the email template we showed above is also linked to the ClickDimensions email send record.

New homes email send

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 home records are 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.

Sent email

This has been a complex example, but hopefully you are seeing the power of our merging capability, as well as the advantages of enabling dynamic content through the FreeMarker language.

Happy Marketing!