Overview


In order to successfully access tags in your documents and canned emails, it is important to understand the two tools used to access these values, objects and loops. In this article, we will do a quick summary of both as well as an example of accessing tags through these methods to help you get started. 


Understanding Tags, Objects and Loops


Tags

Tags are the representation of data within our system. Tags are accessible by utilizing objects and loops from within our HTML documents and canned emails. 


Objects 

Objects are the data structure in which information is stored within documents. Objects are prepended or "chained" to tags in order to access tag values. It is easiest to conceptualize objects as encapsulations of specific data you are trying to access. For instance, the Customer object holds information about the given customer. Such as their Name, ShippingLocation (sub-object), or PaymentTerms.  You can view a full list of the tag values within the customer object here.


Objects 
SyntaxExample
Object and Tag Value 
{{ObjectName.TagName}}{{Customer.Name}}
Object with a Sub-Object and Tag Value
{{ObjectName.TagName.SubObjectTagName}}{{Customer.ShippingLocation.City}}


Loops

Loops are used to iterate through lists of objects. If you need to access more than a single object, you must use a loop. In order to do this, we can use either a each loop or a withSort loop. In most cases, it does not matter which you choose but the withSort loop will give you more granular control of the order of objects listed. 


Loop Name 
SyntaxExample
each
<!-- {{#each ListName}} -->
        {{SubObjectTagName.TagName}} or {{TagName}}
<!-- {{/each}} -->
<!-- {{#each OrderItems}} -->
        {{Number}}
<!-- {{/each}} -->
withSort
<!-- {{#withSort ListName "SecondaryArgument"}} -->
        {{SubObjectTagName.TagName}} or {{TagName}}
<!-- {{/withSort}}-->
<!-- {{#withSort Orders "Number"}} -->
        {{Number}}
<!-- {{/withSort}} -->