NetSuite Internals – The 3 Main Tables Transactions, Items, Entities

NetSuite Internals – The 3 Main Tables Transactions, Items, Entities

NetSuite Internals: Deep Dive into the Three Core Tables

NetSuite’s data structure revolves around three primary categories of tables:

  1. Entities – Customers, Vendors, Employees, and Contacts
  2. Items – Products, Services, and Inventory
  3. Transactions – Sales Orders, Invoices, Payments, etc.

These tables do not exist as single physical tables but are logical groupings of multiple interconnected tables. Let’s explore each area in depth.


1️⃣ Entities (Customers, Vendors, Employees, Contacts)

Definition

The Entities category in NetSuite represents people and organizations involved in business operations. This includes:

  • Customers
  • Vendors
  • Employees
  • Contacts
  • Partners

Key Tables in Entities

Table NameDescription
CustomerStores information about customers (B2B & B2C).
VendorStores supplier and vendor details.
EmployeeStores internal employee records.
ContactIndividual contacts associated with Customers, Vendors, or Partners.
PartnerStores partner records for channel sales and referral programs.
Lead & ProspectPotential customers before becoming Customer.
SubsidiaryStores company divisions for multi-subsidiary setups.
DepartmentBusiness departments (e.g., Sales, HR, Finance).
ClassClassification for transactions and reporting.
LocationPhysical locations related to business operations.

Entity Relationships

Entities are often linked to transactions, roles, and classification structures.

Example: Customer and Transactions Relationship

A Customer is connected to:

  • Transaction (Sales Orders, Invoices, Payments)
  • Item (Products the customer buys)
  • Employee (Sales Rep handling the customer)

🔹 SQL Example: Fetching Customers and Their Transactions

SELECT 
    c.id AS Customer_ID, 
    c.entityid AS Customer_Name, 
    t.id AS Transaction_ID, 
    t.trandate AS Transaction_Date, 
    t.amount AS Transaction_Amount
FROM 
    Customer c
JOIN 
    Transaction t ON c.id = t.entity
WHERE 
    t.type IN ('SalesOrd', 'Invoice')
ORDER BY 
    t.trandate DESC;

2️⃣ Items (Products, Services, Inventory)

Definition

The Items category represents products and services that a company sells, purchases, or tracks in inventory.

Key Tables in Items

Table NameDescription
ItemMaster table for all item types.
Inventory_ItemStores physical stock-tracked items.
Non_Inventory_ItemItems not tracked in inventory (e.g., labor, services).
Service_ItemStores service-based offerings (e.g., consulting).
Assembly_ItemUsed for manufacturing and assembly (BOM).
Kit_ItemPre-defined bundles of multiple items.
Lot_Numbered_ItemTracks batch-based inventory with lot numbers.
Serialized_ItemTracks inventory with unique serial numbers.
Gift_Certificate_ItemManages gift cards and stored-value items.
PricingStores item-specific pricing rules (by customer, currency, etc.).
Item_LocationTracks item availability by location.

Item Relationships

  • Items link to transactions via Transaction_Line.
  • They are classified under Item Categories, Pricing, and Inventory Locations.

🔹 SQL Example: Fetching Item Sales Data

SELECT 
    i.itemid AS Item_Name, 
    SUM(tl.quantity) AS Total_Quantity_Sold, 
    SUM(tl.amount) AS Total_Sales_Amount
FROM 
    Transaction_Line tl
JOIN 
    Transaction t ON tl.transaction = t.id
JOIN 
    Item i ON tl.item = i.id
WHERE 
    t.type = 'Invoice'
GROUP BY 
    i.itemid
ORDER BY 
    Total_Sales_Amount DESC;

3️⃣ Transactions (Orders, Payments, Bills, Journals)

Definition

The Transactions category represents the financial and operational events within the system, such as:

  • Sales Orders
  • Invoices
  • Purchase Orders
  • Payments
  • Expenses
  • Journal Entries

Key Tables in Transactions

Table NameDescription
TransactionMaster table for all transactions.
Transaction_LineStores line items related to each transaction.
Sales_OrderStores customer orders before fulfillment.
InvoiceStores billed amounts for sales.
Cash_SaleSales completed immediately with payment.
Customer_PaymentRecords customer payments.
Credit_MemoUsed for refunds and credits.
BillStores vendor invoices for payment.
Vendor_PaymentRecords payments made to vendors.
Journal_EntryStores manual accounting adjustments.
Expense_ReportStores employee expenses for reimbursement.

Transaction Relationships

Transactions have multiple dependencies:

  • Entities (Customers, Vendors, Employees) interact with transactions.
  • Items are purchased, sold, or adjusted within transactions.
  • GL Accounts link transactions to financial records.

🔹 SQL Example: Fetching Sales Transactions and Customers

SELECT 
    t.id AS Transaction_ID,
    t.tranid AS Transaction_Number,
    t.trandate AS Transaction_Date,
    t.type AS Transaction_Type,
    c.entityid AS Customer_Name,
    SUM(tl.amount) AS Total_Amount
FROM 
    Transaction t
JOIN 
    Transaction_Line tl ON t.id = tl.transaction
JOIN 
    Customer c ON t.entity = c.id
WHERE 
    t.type IN ('SalesOrd', 'Invoice')
GROUP BY 
    t.id, c.entityid
ORDER BY 
    t.trandate DESC;

4️⃣ How the Three Categories Work Together

These three categories are interdependent, forming a structured data model:

  • Entities (Customers, Vendors, Employees) interact with Transactions (Sales Orders, Invoices, Bills).
  • Transactions include Items (Products, Services, Inventory).
  • Transactions generate financial records (Journal Entries).

Example: Sales Order Flow

1️⃣ A Customer places an order → (Customer Table)
2️⃣ A Sales Order is created → (Transaction Table)
3️⃣ The order contains line items → (Transaction_Line Table)
4️⃣ Items are fetched from Inventory → (Item Table)
5️⃣ Upon fulfillment, an Invoice is generated → (Transaction Table)
6️⃣ The customer makes a Payment → (Customer_Payment Table)
7️⃣ Financial records are updated in the General Ledger.


5️⃣ Best Practices for Working with NetSuite Tables

Use Joins Efficiently – Minimize table joins to avoid performance issues.
Use Indexed Fields – Query using indexed fields like id, entity, trandate.
Limit Data for Performance – Avoid selecting unnecessary columns in SQL/SuiteQL queries.
Use Saved Searches for Reports – If not using SuiteQL, leverage NetSuite’s Saved Searches for reporting.

NetSuite Internals - The 3 Main Tables Transactions, Items, Entities

Leave a Comment