EmailMergeResult Object Members in SuiteScript for NetSuite
The EmailMergeResult object in SuiteScript handles email merge results, including body and subject details.
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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- SuiteScript 2.x Sublist Values: Standard and Dynamic Mode
Use setSublistValue in standard mode; select a line, set its current value and commit it in dynamic mode. Choose the API from the record's mode.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
- SuiteScript Record.setValue: Body Fields, Types and Errors
Set NetSuite body fields with Record.setValue, matching field IDs and value types and checking common API errors.
