Purchase orders
Read legacy ordered and received line amounts
/a/PurchaseOrderEntries_get
Return the line grid with ordered quantity, historical delivered quantity and accounting amounts.
When to use this endpoint
Use after obtaining a header ID when populating the CRM1 Purchase Order grid or Goods Received editor. The response is positional; use the mapped detail route for named fields.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. Session requests use dispatcher CSRF protection when configured. API keys use their owner’s identity.
Purchase Order View is required on the singular or plural page. Records must be active and inside the configured TeamAccess or legacy Department Based Filter boundary; administrators are exempt from record restrictions. API-key requests use their owner’s identity. Related display names require the corresponding page View and record visibility.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
po_id | Positive integer-compatible | Yes | Local Purchase Order header ID. Integer-converts above 0; the handler does not itself require an active/visible parent. |
Example request
$result = FM_api('PurchaseOrderEntries_get', ['po_id'=>'1042']);
Example response
[
[
"2081",
"2",
"0",
"Packing materials",
"2.5000",
1.25,
"10.0000",
"25.00",
"5.00",
"EXP-LOCAL",
"VAT20"
]
]
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error": "missing or invalid parameter: po_id"} | Parent input is absent or integer-converts below 1. |
{"error":"permission denied"} | The required page permission is missing. Hidden/deleted records are omitted from collections; explicit parent readers reject an inaccessible parent. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Each row has 11 positions: line ID, stock type (1 catalogue/2 miscellaneous), stock ID, description, ordered quantity, delivered quantity, unit net cost, line net, line tax, nominal code and tax code. Database fields retain stored scalar types.
- Requires an existing active visible parent. Catalogue descriptions require stock View and an active visible stock row; missing/inaccessible catalogue names can be false/blank. Miscellaneous descriptions use stock_text.
- Delivered quantity sums receipt rows by canonical poe_id, including legacy rows whose redundant po_id is unset. Whole sums are integers, fractions are floats and absent receipts yield integer zero. Returns/stock moves are not subtracted.
- Rows sort by sort_num then line ID. Empty visible orders return []; no pagination or count envelope.
Side effects
- Reads tenant data without modifying orders, lines, stock, approval, history or notifications.
See it in Fieldmotion
CRM1
In CRM1 Purchase Order details, load the line grid; in Goods Received, select an order. Filter for PurchaseOrderEntries_get.
CRM2
In CRM2 Goods Received line entry, load the Purchase Order’s lines and inspect PurchaseOrderEntries_get in widgetGoodReceivedEntry. The mobile app uses the separate m/www PurchaseOrders_list/OrdersM contract: owned Open/Part Received orders, page/page_size/search/status controls and mobile permissions. The same function name does not imply this office response or pagination.
Related endpoints
PurchaseOrderEntry_getRequestedDetails— Use explicit checked mapped line detail selection.