Using Field Codes in Email Templates: A Guide to Dynamic Content
Using Field Codes in Email Templates: A Guide to Dynamic Content
Using Field Codes in Email Templates: A Guide to Dynamic Content
This guide provides a fact-checked overview of how to use field codes in your email templates.
This guide provides a fact-checked overview of how to use field codes in your email templates.
This guide provides a fact-checked overview of how to use field codes in your email templates.
7 min read
Personalized, data-rich emails are a hallmark of professional business communication. NetSuite allows you to create dynamic email templates by using field codes (also called merge fields), which automatically insert data from the record into the email's subject and body. This guide provides a fact-checked overview of how to use field codes in your email templates.
What Are Field Codes?
A field code is a placeholder that references a specific field on a NetSuite record. When the email is generated, NetSuite replaces the field code with the actual value from that field. This allows you to create a single email template that can be used for thousands of transactions, with each email containing the correct, personalized data.
Example:
Instead of writing "Dear Customer," you can write Dear {entity}, and NetSuite will replace {entity} with the actual customer name, resulting in "Dear Acme Corporation."
Field Code Syntax
Field codes are written using the following format:
{fieldid}
The `fieldid` is the internal ID of the field, not the label you see on the form. For example, the internal ID for the "Transaction Number" field is tranid, not "Transaction #."
Commonly Used Field Codes
Transaction Fields
Field Code | Description |
|---|---|
| The transaction number (e.g., "INV-12345"). |
| The transaction date. |
| The total amount of the transaction. |
| The payment due date (for invoices and bills). |
| The memo field content. |
| The current status of the transaction. |
Entity Fields
Field Code | Description |
|---|---|
| The name of the customer or vendor. |
| The email address of the entity. |
| The company name of the entity. |
| The first name of the contact. |
| The last name of the contact. |
Related Record Fields
Field Code | Description |
|---|---|
| The name of the sales representative. |
| The payment terms. |
| The subsidiary name. |
Custom Fields
Custom fields follow a specific naming pattern:
Transaction Body Fields:
{custbody_yourfieldid}Entity Fields:
{custentity_yourfieldid}Item Fields:
{custitem_yourfieldid}
How to Find the Correct Field ID
If you are unsure of the internal ID for a field, you can find it using one of the following methods:
Field Definition Page: Navigate to Customization > Lists, Records & Fields and select the appropriate field type (e.g., Transaction Body Fields). The ID column shows the internal ID for each field.
Page Source: Open the record in NetSuite, right-click on the page, and select "View Page Source." Search for the field label, and you will find the
idornameattribute of the HTML element, which is usually the field ID.
Example: An Invoice Email Template
Subject:
Invoice {tranid} from {subsidiary} - Due {duedate}
Body:
Dear {entity},Thank you for your business. Please find attached Invoice {tranid} dated {trandate} for a total of {total}.Payment is due by {duedate}. Your payment terms are {terms}.If you have any questions about this invoice, please contact your account manager, {salesrep}.Best regards,{subsidiary}
Where to Use Field Codes
Transaction Email Templates: Customize the email that is sent when you click "Email" on a transaction form.
Workflow Email Actions: Use field codes in the subject and body of emails sent by SuiteFlow workflows.
Saved Search Email Alerts: Use field codes to personalize the content of scheduled email alerts.
Best Practices and Troubleshooting
Always Test: Before deploying a new template, send a test email to yourself to verify that all field codes are resolving correctly.
Blank Values: If a field code appears as blank in the email, it means the field is empty on the record or the field ID is incorrect.
Literal Text: If a field code appears as literal text (e.g.,
{tranid}) in the email, it means the field ID is misspelled or does not exist.
Create a Reference Sheet: Maintain a document with the most commonly used field codes for your organization to reduce errors and save time.
Personalized, data-rich emails are a hallmark of professional business communication. NetSuite allows you to create dynamic email templates by using field codes (also called merge fields), which automatically insert data from the record into the email's subject and body. This guide provides a fact-checked overview of how to use field codes in your email templates.
What Are Field Codes?
A field code is a placeholder that references a specific field on a NetSuite record. When the email is generated, NetSuite replaces the field code with the actual value from that field. This allows you to create a single email template that can be used for thousands of transactions, with each email containing the correct, personalized data.
Example:
Instead of writing "Dear Customer," you can write Dear {entity}, and NetSuite will replace {entity} with the actual customer name, resulting in "Dear Acme Corporation."
Field Code Syntax
Field codes are written using the following format:
{fieldid}
The `fieldid` is the internal ID of the field, not the label you see on the form. For example, the internal ID for the "Transaction Number" field is tranid, not "Transaction #."
Commonly Used Field Codes
Transaction Fields
Field Code | Description |
|---|---|
| The transaction number (e.g., "INV-12345"). |
| The transaction date. |
| The total amount of the transaction. |
| The payment due date (for invoices and bills). |
| The memo field content. |
| The current status of the transaction. |
Entity Fields
Field Code | Description |
|---|---|
| The name of the customer or vendor. |
| The email address of the entity. |
| The company name of the entity. |
| The first name of the contact. |
| The last name of the contact. |
Related Record Fields
Field Code | Description |
|---|---|
| The name of the sales representative. |
| The payment terms. |
| The subsidiary name. |
Custom Fields
Custom fields follow a specific naming pattern:
Transaction Body Fields:
{custbody_yourfieldid}Entity Fields:
{custentity_yourfieldid}Item Fields:
{custitem_yourfieldid}
How to Find the Correct Field ID
If you are unsure of the internal ID for a field, you can find it using one of the following methods:
Field Definition Page: Navigate to Customization > Lists, Records & Fields and select the appropriate field type (e.g., Transaction Body Fields). The ID column shows the internal ID for each field.
Page Source: Open the record in NetSuite, right-click on the page, and select "View Page Source." Search for the field label, and you will find the
idornameattribute of the HTML element, which is usually the field ID.
Example: An Invoice Email Template
Subject:
Invoice {tranid} from {subsidiary} - Due {duedate}
Body:
Dear {entity},Thank you for your business. Please find attached Invoice {tranid} dated {trandate} for a total of {total}.Payment is due by {duedate}. Your payment terms are {terms}.If you have any questions about this invoice, please contact your account manager, {salesrep}.Best regards,{subsidiary}
Where to Use Field Codes
Transaction Email Templates: Customize the email that is sent when you click "Email" on a transaction form.
Workflow Email Actions: Use field codes in the subject and body of emails sent by SuiteFlow workflows.
Saved Search Email Alerts: Use field codes to personalize the content of scheduled email alerts.
Best Practices and Troubleshooting
Always Test: Before deploying a new template, send a test email to yourself to verify that all field codes are resolving correctly.
Blank Values: If a field code appears as blank in the email, it means the field is empty on the record or the field ID is incorrect.
Literal Text: If a field code appears as literal text (e.g.,
{tranid}) in the email, it means the field ID is misspelled or does not exist.
Create a Reference Sheet: Maintain a document with the most commonly used field codes for your organization to reduce errors and save time.
Ready to Work Together?
Ready to Work Together?
Ready to Work Together?
Let us talk about your NetSuite challenges and how we can help. No pressure, no sales pitch. Just a straightforward conversation.
Let us talk about your NetSuite challenges and how we can help. No pressure, no sales pitch. Just a straightforward conversation.
Author


Michael Strong
Michael Strong
Founder & Principal Architect
Founder & Principal Architect
Tags
Read More
Read More


