Introduction
When you create a new transaction (i.e. Sales Order, Invoice), NetSuite will automatically source the “To Be E-mailed” field using the email field from the customer record (See below). This is okay if you just want to send to one email address, but what if you want to send to multiple email addresses? NetSuite does not have a native way to accomplish this. This article will detail how to do this using either a custom record or the contact record and SuiteScript.

Option 1 : Custom Record – “Customer Email Address”
This custom record will have two fields.
- Customer – List/Record Customer – Select Record is Parent and put on “Communication” tab
- Email – Email Address


Option 2: Contact Record
Add a custom checkbox entity field to the contact record. You would check this box to have the email address show up in the “To Be Emailed” text field.

SuiteScript
There is one client script that you can deploy on any transaction record which has a customer and can be emailed (i.e. Sales Order, Invoice).
Client Script Summary:
- On the creation of a transaction or if the customer is changed:
- Script will search for all email addresses using:
- Option 1: Custom Record. It will get the email in the “Email” field on the customer record.
- Option 2: Contact record. It will get the email for all contact where “Send Transaction” is checked.
- The “To Be E-mailed” checkbox will be checked.
- The email field will be set to all the email addresses from customer record.

The code:
/**
*@NApiVersion 2.1
*@NScriptType ClientScript
*/
define(['N/search'], (search) => {
pageInit = (context) => {
if (context.mode === 'create') {
const newRecord = context.currentRecord;
loadEmails(newRecord);
}
}
fieldChanged = (context) => {
const field = context.fieldId;
const currentRecord = context.currentRecord;
if (field == 'entity') {
loadEmails(currentRecord);
}
return true;
}
loadEmails = (newRecord) => {
const customer = newRecord.getValue('entity');
if (customer) {
let emails = [];
/********************************/
/* Option 1 - use custom record */
/********************************/
/*
const customerEmailSearch = search.create({
type: "customrecord_customer_email_address",
filters: [
["custrecord_customer_email_customer", "anyof", customer]
],
columns: [
"custrecord_customer_email_email"
]
});
customerEmailSearch.run().each(function (result) {
emails.push(result.getValue('custrecord_customer_email_email'));
return true;
});
*/
/************************************************/
/* Option 2 - use Contacts from customer record */
/************************************************/
const customerEmailSearch = search.create({
type: "contact",
filters: [
["company", "anyof", customer],
"AND",
["custentity_send_transaction", "is", 'T'],
],
columns: [
"email"
]
});
customerEmailSearch.run().each(function (result) {
emails.push(result.getValue('email'));
return true;
});
const fieldLookUp = search.lookupFields({
type: search.Type.CUSTOMER,
id: customer,
columns: ['email']
});
emails.push(fieldLookUp.email);
let allEmails = emails.join(';');
newRecord.setValue('tobeemailed',true);
newRecord.setValue('email', allEmails);
}
}
return {
pageInit: pageInit,
fieldChanged: fieldChanged
};
});
Conclusion
I hope you enjoyed reading about this simple customization. If you need help with customizing NetSuite, please contact Suite Tooth Consulting and we would be happy to help you.