Email Template

The email template record is used for both CRMSDK templates and scriptable templates. In the UI, you find this record by choosing Documents > Templates > Email Templates. This record is available only if the Customer Relationship Management feature has been enabled at Setup > Company > Enable Features, on the CRM tab.

For help working with this record in the UI, see Working with Email Templates.

Scriptable templates are not supported with SuiteScript.

The internal ID for this record is emailtemplate.

See the SuiteScript Records Browser for the internal IDs of all fields associated with this record, their corresponding labels in the UI, and more details. Fields not listed in the Records Browser are not supported and should not be used.

Note:

For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser.

For information about scripting with this record in SuiteScript, see the following:

Supported Script Types

This record is only supported in server SuiteScript.

All three user events are supported: beforeLoad, beforeSubmit, and afterSubmit.

Field Definitions

This section describes some of the key fields on the email template record.

Content and Mediaitem

When accessing this record, only one of the following fields contains a value:

Code Sample

The following sample shows how to access template content:

          var template = record.load({
    type: record.Type.EMAIL_TEMPLATE,
    id: 124
});

if (template.getValue({fieldId: 'mediaitem'}) != null) {
    var media = template.getValue({fieldId: 'mediaitem'});
    // do something with the media...
} else {
    var content = template.getValue({fieldId: 'content'});
    // do something with the content...
} 

        

Related Topics

Working with Email Templates
Working with the SuiteScript Records Browser
SuiteScript Supported Records
Marketing

General Notices