Easy-Acumatica Docs

CaseBuilder

The `CaseBuilder` is your primary tool for creating the JSON payload needed to create or update Case records with the `CasesService`. It provides a fluent, chainable interface for setting the fields of a case record, including related cases and custom fields.

Importing the Builder

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

python

from easy_acumatica.models.case_builder import CaseBuilder

Builder Methods

Standard Fields

Use the shortcut methods to set common top-level fields on the case record. For any other field, you can use the generic `.set()` method.

python

case_payload = (
    CaseBuilder()
    .class_id("SUPPORT")
    .business_account("ABCCORP")
    .subject("Cannot log in to portal")
    .set("Priority", "High") # Using the generic .set() method
)
set_custom_field(view, field, value, ...)

This method allows you to set custom fields defined in your Acumatica instance.

python

case_payload = (
    CaseBuilder()
    .subject("Inquiry about support tiers")
    .set_custom_field(
        view="Case",
        field="UsrSupportTier", # Custom field name
        value="Gold"
    )
)
to_body()

Once you have set all the required fields, call the `.to_body()` method to generate the final dictionary. This dictionary is formatted correctly and is ready to be sent as the JSON body in your API request.

python

# Build the case
case_payload = (
    CaseBuilder()
    .class_id("SUPPORT")
    .subject("Cannot log in")
)

# Get the final dictionary
json_body = case_payload.to_body()

# json_body is now ready to be used with a service method:
# client.cases.create_case("24.200.001", builder=case_payload)
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