Using Claude AI to Build Better NetSuite Email Templates with HTML

Stop wrestling with NetSuite’s template editor. Learn how to use Claude to write clean HTML email templates — complete with dynamic field references, customer data, and document numbers — in a fraction of the time.

Why This Matters

NetSuite’s built-in email template editor is functional, but it doesn’t make it easy to write structured, well-styled HTML. Whether you’re building invoice notifications, sales order confirmations, or dunning letters, getting the HTML right — and referencing the correct dynamic fields — is tedious and error-prone.

Claude AI changes that. You can describe exactly what you need, paste in your field IDs, and get a polished, ready-to-paste HTML template in seconds. This article walks you through the workflow and the most important field IDs you’ll need.


How NetSuite Email Templates Work with HTML

NetSuite email templates support FreeMarker templating — a Java-based syntax that lets you pull in record field values dynamically. When used inside an HTML template, FreeMarker expressions are wrapped in curly brace syntax and reference the triggering record’s fields directly.

NetSuite uses two common syntax patterns:

Standard FreeMarker syntax (most email templates)

<!– Basic field reference –>
${record.fieldid}<!– With a null/default fallback –>
${record.entityid?if_exists}<!– Example: customer name in a body –>
Dear ${record.altname},Your invoice #${record.tranid} is now available.

Note: NetSuite email templates are attached to a specific record type (Invoice, Sales Order, Customer, etc). The record object refers to the triggering record — so the available fields depend on which record type the template is associated with.


Common Field IDs You Need to Know

These are the most frequently used field IDs when building email templates for customer-facing documents like invoices, sales orders, and statements.

Customer / Entity Fields

Field ID Description Example Output
altname Customer display name Acme Corporation
entityid Customer ID / number CUST-1042
companyname Legal company name Acme Corp LLC
email Primary email address ap@acme.com
phone Primary phone number (208) 555-0110
billingaddress Full billing address block 123 Main St…

Transaction / Document Fields

Field ID Description Example Output
tranid Document / transaction number INV-10042
trandate Transaction date 04/07/2026
duedate Due date (invoices) 05/07/2026
total Grand total amount $4,250.00
amountremaining Balance still owed $1,500.00
memo Memo / notes field PO # 8841
otherrefnum Customer PO number PO-8841
terms Payment terms Net 30
salesrep Sales rep name Jane Smith
subsidiary Subsidiary name Stratos West LLC

Shipping / Fulfillment Fields

Field ID Description Example Output
shipaddress Full shipping address block 456 Ship Lane…
shipdate Expected ship date 04/10/2026
shippingcost Shipping charge $25.00
carrier Shipping carrier FedEx Ground

Common mistake: Using name instead of altname for the customer name. In NetSuite, altname is the formatted display name most customers see. companyname is the legal entity name — sometimes different.


The Claude Workflow: Step-by-Step

Here’s exactly how to use Claude to build your NetSuite email templates fast.

  1. Open Claude at claude.ai and start a new conversation.
  2. Tell Claude the record type the template is attached to (Invoice, Sales Order, Customer, etc.).
  3. Describe the purpose and tone of the email (e.g., “a professional overdue invoice reminder”).
  4. Provide the field IDs you want included from the tables above.
  5. Ask Claude to generate HTML using NetSuite FreeMarker syntax with inline CSS for email compatibility.
  6. Paste the result into NetSuite under Setup > Company > Email Templates, selecting HTML as the body type.

Example prompt for Claude

// Paste a prompt like this directly into Claude:

“Create a professional HTML email template for NetSuite for an
overdue invoice reminder. Use inline CSS (no external stylesheets).
The template is attached to an Invoice record. Include these
FreeMarker field references:
– Customer name: record.altname
– Invoice number: record.tranid
– Invoice date: record.trandate
– Amount remaining: record.amountremaining
– Due date: record.duedate
– Sales rep name: record.salesrep

Use a clean, corporate layout. Company name is Stratos ERP Partners.
Add a footer with a note to contact us if there’s a dispute.”

Claude will return a complete, paste-ready HTML email. You can then ask it to adjust colors, add a logo, tweak the tone, or add additional fields — all conversationally.


Additional Tips & Best Practices

Always use inline CSS

Email clients strip <style> blocks. Ask Claude to write all CSS inline on each element for maximum compatibility across Outlook, Gmail, and Apple Mail.

Test with Preview

NetSuite’s template editor has a Preview function. Always preview with a real record to confirm all field IDs resolve correctly before going live.

Use ?if_exists for optional fields

Wrap optional fields with ?if_exists to prevent FreeMarker errors when a field is blank on a record.

Custom fields use custbody_

Custom transaction body fields follow the pattern custbody_fieldname. Ask Claude to include these once you know your custom field IDs from NetSuite.

Line item loops

To list transaction line items, ask Claude to use a FreeMarker <#list> loop over record.item to iterate all lines dynamically.

Brand it once, reuse often

Ask Claude to build a base branded template. Then adapt only the content section — keeping your header and footer consistent across all templates.

Pro tip: Save your best working Claude prompt as a shared doc for your team. Consistency across NetSuite email templates matters for brand experience — and a single great prompt makes that effortless to maintain.


Where to Add Templates in NetSuite

Once your HTML is ready, navigate to Setup > Company > Email Templates. Create a new template, select your record type, and set the body format to HTML. Paste your Claude-generated code directly in. You can also assign templates to workflow actions, invoice reminders, and customer communications from their respective setup screens.