Sample Scriptable Templates
Use the following sample templates to help you create your own custom scriptable templates:
Scriptable Issue Notification Template
The following template can be used for an issue notification. This template lists key fields on the issue record and all details on the issue record.
<table>
<tr><td>Issue Number</td<td>${Issue.issueNumber}</td</tr>
<tr><td>Product Team</td<td>${Issue.productTeam}</td</tr>
<tr><td>Assigned To</td><td>${Issue.assigned}</td></tr>
<tr><td>Type</td><td>${Issue.issueType}</td></tr>
<tr><td>Severity</td><td>${Issue.severity}</td></tr>
<tr><td>Status</td><td>${Issue.issueStatus}</td></tr>
<tr><td>Link</td><td>${Issue.url}</td></tr>
</table>
<hr/>
<p><strong>Abstract: </strong>${Issue.abtract}</p>
<hr/>
<p><strong>Details:</strong> (In Reverse Chronological Order)</p>
<table>
<#list Issue.details as detail>
<tr>
<td>${detail.author}<br/>${detail.date}</td>
<td>
${detail.userNote}<#if detail.userNote != ""><br/></#if>
<#list detail.systemNotes as systemNote>
${systemNote}<#if systemNote_has_next><br/></#if>
</#list>
</td>
</tr>
</#list>
</table>
Scriptable Marketing Email Template
The following marketing email template shows how you can use FreeMarker code to make a personalized offer to the recipient. This offer uses upsell data in NetSuite to find related upsell items.
<b>Dear <#if Customer.companyName != "">${Customer.companyName}<#else>Customer</#if>,</b>
<p>Now you have unique opportunity to get your favorite items with 20% discount!</p>
<p>All you need to do is to use the following coupon code when you place an order on our site: ${CampaignEvent.couponCode}!</p>
<#assign printedOutItems = 0>
<#list Customer.correlatedItems as itemLine>
<#if 33 < itemLine.correlation>
<img src="${itemLine.upsellItem.imageURL}" alt="${itemLine.upsellItem.displayName}" height="128" width="128"/><br/>
</#if>
<#assign printedOutItems = printedOutItems + 1>
<#if printedOutItems = 3><#break></#if>
</#list>
<#if 3 < printedOutItems>
<#list Customer.relatedItems as itemLine>
<img src="${itemLine.upsellItem.imageURL}" alt="${itemLine.upsellItem.displayName}" height="128" width="128"/><br/>
<#assign printedOutItems = printedOutItems + 1>
<#if printedOutItems = 3><#break></#if>
</#list>
</#if>
<p>
Best regards,<br/>
<br/>
${preferences.MESSAGE_SIGNATURE}
</p>
Scriptable Web Store Email Template
This section shows how you can use FreeMarker to customize your web store email templates. You'll learn how to iterate items, display item options, and customize item names.
The following example code shows what you need to iterate items and display item options in your web store email template. This example doesn't contain styling.
<#list salesorder.item as itemline>
<tbody>
<tr>
<!-- item image -->
<td>
<#if (itemimages[itemline.item.internalId])?has_content>
<img src="${itemimages[itemline.item.internalId]}">
</#if>
</td>
<!-- item details -->
<td>
<!-- item name with link -->
<div><a href="${itemurls[itemline.item.internalId]}">${itemline.item}</a></div>
<!-- if it's a matrix item -->
<#if (itemline.options)?has_content>
<#assign br = "<br />">
<#list (itemline.options)?split(br) as option>
<#assign label=option?substring(0,option?index_of(":")) value=(option?substring(option?index_of(":")+1))?trim>
<div>${label}: ${value}</div>
</#list>
</#if>
<div>Quantity: ${itemline.quantity}</div>
<div>Unit Price: ${itemline.rate}</div>
</td>
<td>${itemline.amount}</td>
</tr>
</tbody>
</#list>
Variable |
Description |
---|---|
|
Iterates over a list of sales order items using |
|
A conditional is used to check whether the After that, the full product name is printed, using a technique similar to what is used for the image, except referencing the |
|
Checks if the item options exist so they can be iterated. |
|
Item options are made into a list by splitting them up using the line break element that the variable contains. Each option is then split up again, by assigning the label and the value as a variable. |
Item Name
The following example code demonstrates how to use FreeMarker to shorten the item name in your web store email template. By default, the full item name ${itemline.item}
returns something similar to SPORTSWEAR : TEES & TANKS : Tranquility Tank : Tranquility Tank-M-YE.
<!-- At the top of the loop -->
<#assign itemName = itemline.item?split(":")>
<!-- And then in the place you want it rendered -->
${itemName[itemName?size-2]?trim}
Variable |
Description |
---|---|
|
This splits the full item name into an array, breaking it up into smaller strings each time there's a colon character. |
|
Calls the variable where the name is to be rendered, but only returns a specific value. The specific value is determined by counting the length using |
For more information about web store email templates, see Templates for Website Email Messages.