EmailMergeResult Object Members in SuiteScript
The EmailMergeResult object encapsulates email merge results, including email body and subject for server scripts.
The EmailMergeResult object serves as a key component within the N/render module for SuiteScript, allowing developers to manage email merge results effectively. This object provides essential properties such as the email body and subject, making it simple to control and utilize email distributions in automated scripts.
Overview of the EmailMergeResult Object Members
Properties
| Property Name | Type | Description |
|---|---|---|
| EmailMergeResult.body | string (read-only) | Contains the body of the email distribution in string format. |
| EmailMergeResult.subject | string (read-only) | Contains the subject line of the email distribution in string format. |
How to Use the EmailMergeResult Object
To create and return an EmailMergeResult object, you use the render.mergeEmail(options) method. Below is a sample of how to create an email merge result:
1// Sample SuiteScript code to create an EmailMergeResult2var mergeResult = render.mergeEmail({3 templateId: 1234,4 entity: {5 type: 'employee',6 id: 627 },8 recipient: {9 type: 'lead',10 id: 4111 },12 supportCaseId: 2, 13 transactionId: 271,14 custmRecord: null15});This sample demonstrates setting the necessary options, such as templateId, entity, and recipient, to successfully generate the email content you need.
Related Resources
For further details, check out the N/render module documentation and look into advanced scripting techniques using the TemplateRenderer object to enhance your email merge capabilities.
Who This Affects
This information is valuable for:
- Developers creating automated email communications
- Administrators managing scripts and templates within NetSuite
Key Takeaways
- The
EmailMergeResultobject is essential for handling email distributions in SuiteScript. - It includes properties for the email body and subject, both read-only, which simplifies mail generation.
- Utilize the
render.mergeEmail(options)method to create the object effectively.
Frequently Asked Questions (4)
How do you create an EmailMergeResult object in SuiteScript?
What properties are available in the EmailMergeResult object, and what do they contain?
Can the properties of the EmailMergeResult object be modified directly?
Is the EmailMergeResult object applicable to both WMS and standard NetSuite environments?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
