Easy-Acumatica Docs

RecordBuilder

The `RecordBuilder` offers a fluent, generic way to construct JSON payloads for any Acumatica entity—customers, orders, stock items, etc.—without manual nesting or merging. It is the most flexible builder in the library.

Importing the Builder

To get started, import the `RecordBuilder` from the `easy_acumatica.models` module.

python

from easy_acumatica.models.record_builder import RecordBuilder

Core Methods

.field(name, value)

Sets a simple data field, automatically wrapping it in the required `{"value": ...}` structure.

python
rb = RecordBuilder().field('CustomerID', 'CUST100')
.add_detail(name)

Appends a new line item to a detail list (e.g., `OrderLines`). This returns a new builder scoped to that specific line, allowing you to set its fields.

python

order = RecordBuilder().field("OrderType", "SO")

# Add first order line
order.add_detail("OrderLines") \
     .field("InventoryID", "ABC123") \
     .field("Quantity", 5)

# The builder is now scoped to the line; .up() is not needed
# to add another line to the same detail list.
order.add_detail("OrderLines") \
     .field("InventoryID", "XYZ789") \
     .field("Quantity", 2)
.custom(view, field, value, ...)

Sets user-defined or custom fields, creating the nested `custom` block in the JSON payload.

python

rb = RecordBuilder()
rb.custom(
    "SalesOrderEntry", 
    "UsrPriority", 
    value="High", 
    type_="CustomStringField"
)
Easy-Acumatica v0.3.9 — Created and Developed by Matthew Hirstius (Nioron07).
Significant Contributions made by Chris Xu
Want to see the NPM version? See it here