Purchase orders
Find receivable orders for a supplier
/a/PurchaseOrders_getBySupplierId
List a supplier’s orders with received status Open or Part Received.
When to use this endpoint
Use the Goods Received supplier picker before selecting an order and reading its lines. The input id is a supplier ID, unlike PurchaseOrder_get’s header ID.
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 |
|---|---|---|---|
id | Positive integer-compatible | Yes | Tenant supplier ID; integer-converts above 0. The handler does not validate the supplier’s active/held state or its page visibility. |
Example request
$result = FM_api('PurchaseOrders_getBySupplierId', ['id'=>'42']);
Example response
[
{
"id": "1042",
"po_num": "318",
"reference": "PO-318"
}
]
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: id"} | Supplier ID 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
- Filters the supplied supplier ID, active headers, record visibility and status<2: Open or Part Received, plus any historical negative status.
- Returns local id, displayed po_num and reference; no remaining-quantity calculation, order, pagination or cap. CRM1 sorts options by po_num itself.
Side effects
- Reads tenant data without modifying orders, lines, stock, approval, history or notifications.
See it in Fieldmotion
CRM1
In CRM1 Goods Received, change Supplier and inspect PurchaseOrders_getBySupplierId. Selecting an order then calls PurchaseOrderEntries_get.
CRM2
No direct CRM2 literal caller was found in the searched client source.
Related endpoints
PurchaseOrderEntries_get— Read lines after selecting a returned order.PurchaseOrder_get— Read one checked header.