Common errors when naming Handlebars / Custom fields

When naming handlebars in dynamic templates it is common to encounter certain errors that could be difficult to identify. A common error message is "Your template has been successfully saved, but we've detected an issue with your handlebars code that requires attention". Most of the time, errors like this are easy to solve. This guide explains how to identify and resolve these issues.

Naming handlebar and custom fields

We recommend using the following naming conventions:

  • Field names should only use alphanumeric characters (A-Z and 0-9) and underscores (_). Custom fields should only begin with letters A-Z or underscores (_).

Here you can see some examples of good and bad uses when naming handlebars:

Correct use:

{{{First_Name}}}
{{{Address_of_customer_USA}}}
{{{Name1}}}
{{{_Name}}}

Incorrect use:

{{{First Name}}}  // Spaces aren't allowed.
{{{1Name}}} // Names should always start with a letter or an underscore.
{{{First&Name}}} // Special characters aren't allowed.

Notice: If attempting to use {{{First Name}}}, the system will let you save the template and will not point out an error. However, when dynamic content is passed, the system will not be able to identify a word with spaces. Therefore, the system is not going to be able to replace the information. 

Spaces are meant to be used with a different purpose than naming custom fields or handlebars. For instance, spaces are used with conditionals or iterations

Dynamic templates

If you attempt to save your template with an incorrectly formatted name, you'll likely see a generic error. Here's an example:

Your template has been successfully saved, but we've detected an issue with your handlebars code that requires attention.

In this situation, we recommend that you scan the names of your handlebars in the template to try and identify errors. The following image shows the error that you will obtain when attempting to save handlebars with bad naming practices, using special characters, or if the first character of the handlebar is a number:

emailTEMPLATE_01_550px.png 

Once you have updated both names appropriately, you should be able to save your template just fine.

Marketing campaigns (new)

When using Single Sends in the new Marketing Campaigns, you would use custom fields. If errors are present in the names, the Custom fields system will give you a warning message. You won't be able to create the field until you give it an appropriate name.

For example, I used the special character * here. The system will not let you create the field until you have given an appropriate name. 

Screenshot_2022-02-13_at_12.20.42_PM.png

Have more questions? Submit a request