Luis
03/04/2025, 3:09 PMCeligo AI
03/04/2025, 3:10 PMAI generated answer (using internal Slack threads):To add dynamic field values to an email template that is used in
email.send
and render.mergeEmail
functions in NetSuite, you can use the render.mergeEmail
function. This function allows you to merge an email template with a record and custom data.
Here is an example of how you can use it:
javascript
var mergeResult = render.mergeEmail({
templateId: 10,
entity: {
type: 'customer',
id: 123
},
customData: {
field1: 'custom value 1',
field2: 'custom value 2'
}
});
email.send({
author: currentUser,
recipients: '<mailto:myname@gmail.com|myname@gmail.com>',
subject: mergeResult.subject,
body: mergeResult.body,
});
In this example, templateId
is the internal ID of the email template, entity
is the record that you want to merge with the template, and customData
is an object that contains the custom data that you want to merge with the template. The customData
object can contain any number of fields, and the values of these fields can be any valid JavaScript value.
In your email template, you can reference the custom data using the ${customData.fieldName}
syntax. For example, if you have a custom field named field1
, you can reference it in your template like this: ${customData.field1}
.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
03/04/2025, 3:10 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.863847315
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84201318
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839287281
Celigo AI
03/04/2025, 3:10 PM