Dynamic Content Syntax
PREREQUISITE : Dynamic Content
Allows the user to create dynamic content statements without needing to know the syntax.
A new syntax has been created in the system which allows developers to keep all content and logic within one document.
Syntax
- ##FirstName##
- ##FirstName Format="Firstlettercapital"##
- ##FirstName Default="Customer"##
- ##FirstName Format="Firstlettercapital" Default="Customer"##
Data Types for Format
- Email : No formatting options
- Text : ALLCAPS, lowercase, Firstlettercapital, EachWordFirstLetterCapital
- Number : WholeNumber, OneDecimal, TwoDecimal
- Date : MM/dd/yyyy, MM-dd-yyyy, MMMM dd, yyyy, MMM dd, yyyy
Dynamic Content Syntax.
HTML
###variablename###
if (field[FieldName] operator "value" ) { "Content" }
else if (field[FieldName] operator "value" ) { "Content" }
else { "Content" }
###/variablename###
Logic Breakdown (Part 1)
HTML
if (field[FieldName] operator "value" )
- FieldName has to match the one in CONNECT, Operators are different depending on the Field type (i.e. Email, Text, Date, Number)
- You can have as many else if’s as needed
Logic Breakdown (Part 2)
Email/Text Operators:
equals, is_not, begins_with, contains, not_contain, is_empty, not_empty
Number/Date Operators:
HTML
==, !=, greater, greater_or_equal, less, less_or_equal, is_empty, not_empty
AND/OR Statements:
HTML
if ((field[ ] ) && (field[ ] ))
HTML
if ((field[ ] ) || (field[ ] ))
HTML
if (((field[ ] ) && (field[ ] )) || (field[ ] ))
For Each Statements:
Use the for.each statement by itself:
HTML
for.each({"test data"})
for.each({block "<table><tr><td>Some text</td></tr></table>"})
for.each({image: "<img src="http://imagefile.jpg">"})
Or combined with an IF statement:
HTML
if(condition) {block "for.each({"test data"})"}
if(condition) {block "for.each({block "<table><tr><td>Some text</td></tr></table>"})"}
if(condition) {block "for.each({image: "<img src="http://imagefile.jpg">"})"}
Content Types
Text: Should only contain text, no HTML.
Example:
HTML
{ "Here is some text" }
Image: Should only contain an image tag.
Example:
HTML
{ image"<img src="http://imagefile.jpg">" }
Block: Can contain anything including code.
Example :
HTML
{ block"<table><tr><td>Some text</td></tr></table>" }
Web and Text Versions
Web versions
- Continue to use the ##webversionurl## tag and Connect will handle the rest.
- If the client would like different content on their web version vs email message, you can use the following:
HTML
if (content[type] == "email" ) or if (content[type] == "webversion")
Text Versions
- Use the "Auto Generate Text Version" option in CONNECT or leave it to the AM.
- No separate text version logic required.
System Variables
These variables provide data from the system for various use cases. They all begin with "system" and are proceeded by the variable name.
Eg. ##system:deploymentid##
Variable | Description |
deploymentid | Provides the ID of the deployment at the time of send and is great for adding context to other tracking code. |