> For the complete documentation index, see [llms.txt](https://docs.stacksync.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stacksync.com/two-way-sync/connectors/netsuite/transaction-line-items.md).

# How NetSuite Transactions and Line Items Are Synced

NetSuite transactions, including Sales Orders, Purchase Orders, Invoices, Vendor Bills, Item Fulfillments, Credit Memos, and Journal Entries, contain transaction-level fields and one or more line items.

This page explains how Stacksync synchronizes NetSuite transactions with connected databases and systems, and why transaction line items cannot be synchronized as a separate, independently writable table.

### Each transaction includes its line items

Stacksync synchronizes each NetSuite transaction as a single record in the connected database or system.

The record includes:

* **Top-level transaction fields**, such as the transaction ID, transaction number, customer or vendor, date, status, currency, and total amount.
* **Transaction line items**, such as products, services, accounts, quantities, rates, and line amounts.

The line items are included as a JSON array within a field on the transaction record. They are not synchronized as separate records or in a separate table.

Most transaction types include their line items in the `itemList` field. Journal-based transactions, including Journal Entries and Intercompany Journal Entries, include their lines in the `lineList` field.

For example, a Sales Order is synchronized as one database row containing its top-level fields and an `itemList` column with all associated Sales Order lines:

| id    | tranid  | entity   | itemList                                    |
| ----- | ------- | -------- | ------------------------------------------- |
| 12345 | SO-1001 | ABC Corp | JSON array containing all Sales Order lines |

The `itemList` column may contain:

```json
[
  {
    "item": {
      "internalId": "38704"
    },
    "quantity": 2,
    "rate": 10.0,
    "line": 1
  },
  {
    "item": {
      "internalId": "38705"
    },
    "quantity": 1,
    "rate": 25.0,
    "line": 2
  }
]
```

The transaction is therefore synchronized as one record, with its line items included as nested data within that record.

### Can line items be synced as a separate table?

No.

This is a limitation of the NetSuite transaction model, not a limitation of Stacksync.

In NetSuite, a transaction line is not an independent record. It exists only as part of its parent transaction and NetSuite does not provide any API operation that allows a transaction line to be created, updated, or deleted atomically, independently of the transaction that contains it.

All line-level changes must be made through the parent transaction endpoint and require submitting the entire transaction, including the header and all line items, not just the modified fields. This applies to:

* Adding a line
* Editing a line
* Removing a line
* Creating a transaction. It is not possible to create a transaction and then creating line items seperately.

Because line items cannot be written independently of the transaction header and of the other transaction lines, Stacksync cannot synchronize them as a separate independently writable table.

### Why this matters for bidirectional synchronization

Stacksync supports bidirectional synchronization between NetSuite and connected databases or systems.

For changes to be synchronized reliably in both directions, the data structure in the connected system must remain compatible with the operations supported by NetSuite.

Since NetSuite only allows transaction lines to be changed through their parent transaction, the transaction must remain the unit of synchronization.

This means:

* Each transaction is synchronized as one record.
* Its line items remain associated with that record.
* A line-item change is synchronized as an update to the parent transaction.
* Line items cannot be managed as standalone writable records.

This behavior applies across NetSuite transaction types, including:

* Sales Orders
* Purchase Orders
* Invoices
* Vendor Bills
* Item Fulfillments
* Item Receipts
* Credit Memos
* Return Authorizations
* Transfer Orders
* Journal Entries

### Working with line items in connected systems

Although line items cannot be synchronized as an independent writable table, they can still be used by applications, workflows, and database processes in the connected system.

The `itemList` or `lineList` field can be read, transformed, and updated like any other synchronized field. For example, a workflow or application can:

* Add a new transaction line
* Update the quantity, rate, account, or amount of an existing line
* Remove a transaction line
* Transform line-item data before sending it back to NetSuite

When the JSON array is updated in the connected database, Stacksync detects the change and synchronizes the updated parent transaction back to NetSuite.

Because NetSuite requires all line-item changes to be submitted through the parent transaction, the complete updated `itemList` or `lineList` value must be written to the transaction record.

{% hint style="info" %}
Line items may be expanded into separate rows or tables for application logic, workflows, or analytics. However, changes intended for NetSuite must ultimately be written back to the parent transaction's `itemList` or `lineList` field.
{% endhint %}

### Official NetSuite references

For additional information, refer to the following NetSuite documentation:

* [SOAP: Create Transaction with Line Items](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3690924.html#bridgehead_N3690960)
* [REST: Create Transaction with Line Items](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_159665260887.html#subsect_159674593263)

{% hint style="info" %}
SuiteQL can query transaction-line data independently, but it is a read-only interface. It does not support creating, updating, or deleting records in NetSuite.
{% endhint %}

For additional questions, contact the Stacksync team at <hello@stacksync.com>.
