Inserting Subtemplates into Templates
You can use the include
directive to add another template inside of your template. This is useful when you have information you want to use in many templates. For example, you might make a template as a header for all your communication. The header may include your company logo and contact information. The include
directive can reference template files by URL or File Cabinet ID.
For example, to add a template in the NetSuite File Cabinet with the internal ID of 123, you could use:
<#include "123">
The number must be a file ID, not a template ID.
To insert a template by referencing the URL, you could use:
<#include "http://example.com/templates/myheader.ftl">
If you include templates from outside NetSuite, your email might not generate properly if there's a problem with the URL or hosting site. Additionally, if the hosting website doesn't respond to the request for the template within five seconds, the email message is generated without that template. If the hosting website is an SSL site, it must have a trusted SSL certificate.
Templates that you insert with include
directives can't have their own include
directives.
Custom Record Fields
You can reference fields on custom records using the same syntax used for standard fields and records:
{recordID.fieldID}
For example, if you want to reference a field with the internal ID customfield1 on a custom record with internal ID customrecord1, you can use:
{customrecord1.customfield1}
Including Images and Files
You can include images and files in scriptable templates.
There are three standard image fields you can add to scriptable templates:
-
Item Display Image (ID:
storeDisplayImage
) - item record -
Item Display Thumbnail (ID:
storeDisplayThumbnail
) - item record -
Image (ID:
image
) - entity records
References to these images are structured like this:
<img src="${contact.image}">
Including this code in a template creates a link to the image using the publishable URL on the image’s file record in the File Cabinet.
To include a link to a file in a scriptable template, reference the file record ID in an insert
directive. For example, the following code adds the publishable file URL for file 123 in your email message:
<#include "123">
You can also include image and file custom fields in your templates.