📄️ What are Scriptlets
Document Studio supports Scriptlets, an email templating language that lets you include sophisticated logic with conditional operators. For instance, use the if/else filter to conditionally render some content if a specified condition is true. If the condition is false, no content is rendered or another block of content may be rendered.
📄️ Dynamic Strings
Scriptlets allow you to easily format strings with filters. You can capitalize words, append text, or even truncate the string.
📄️ Array Filters
If you have a text string that is separated with a delimiter, like a comma, you can use the array filter to extract data, sort the list or output the content in a different format.
📄️ Formatting Dates
The date filters in scriptlets are useful for calculating and manipulating dates. For instance, if you have a Google Form and want to send out an email with the day of the week it was filled on, you can make use of the date filter with the appropriate format.
📄️ Math Operators
Scriptlets allow you to easily perform mathematical operations on a string. You may add, subtract, multiply, or divide two numbers, or perform any mathematical operation on a number.
📄️ Text Substitution
Scriptlets allow you to easily replace or remove text from a string with filters. You may replace the first occurrence of a string with another string, or remove all occurrences of a string from the input text.
📄️ HTML Operations
Scriptlets make it easy to output HTML-safe content for rich emails. For instance, it can convert newlines to ` tags, or escape HTML characters like &`.
📄️ Arrays and Loops
Scriptlets allow for loops to be used in your templates for looping over an array collection. You can also loop through a range of numbers using the 1..n syntax.
📄️ Logical Statements
Like most other programming languages, Scriptlets support if and else statements to only output content when certain conditions are met.