Service Orders Sub Service - Nioron07/Easy-Acumatica GitHub Wiki

This guide covers the ServiceOrdersService, which is your primary tool for retrieving service order records through the contract-based API.

[!WARNING] This service is currently untested due to limitations in the development environment. Please contact the library maintainers on GitHub if you encounter any issues with this specific endpoint.

1. Importing Helpers

Before you start, import the necessary query helpers. The ServiceOrdersService methods rely on these to define query parameters.

from easy_acumatica.models.query_builder import QueryOptions
from easy_acumatica.filters import F

2. Understanding the Service's Purpose

The ServiceOrdersService provides a method for retrieving service order records from Acumatica. It acts as the main interface for querying the ServiceOrder endpoint.

3. ServiceOrdersService Methods

The following table summarizes the primary method available in the ServiceOrdersService.

Method Description Key Parameters
.get_service_orders() Retrieves a list of service orders based on query options. api_version, options

4. Retrieving Service Orders

The primary function of this service is to query for existing service orders.

get_service_orders(api_version, options)

This method retrieves a list of service orders. You can use QueryOptions to filter, select, and expand the results.

Example: Get the 5 most recent open service orders

# 1. Define query options
query = QueryOptions(
    select="OrderNbr,CustomerID,Status,Description",
    filter=F.Status == 'Open',
    orderby="CreatedDateTime desc",
    top=5
)

# 2. Retrieve the service orders
try:
    service_orders = client.service_orders.get_service_orders("24.200.001", options=query)
    for order in service_orders:
        print(f"Order: {order['OrderNbr']['value']}, Customer: {order['CustomerID']['value']}")
except Exception as e:
    print(f"Failed to get service orders: {e}")