Goods Received
Inspect the legacy outstanding-item lookup
/a/PurchasesInDelivered_getOutstanding
Find purchase-order lines with a positive unreceived quantity for one catalog item or free-text description.
When to use this endpoint
Use this lookup to identify unreceived quantities for an item across purchase orders. To display every line of one PO, use PurchaseOrderEntries_get; that response separates ordered and received quantities.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. Session CSRF, account-active and IP restrictions still apply. These handlers add no receipt-specific page, finance, department or record-owner permission check.
Records are scoped to the authenticated tenant. CRM1 displays Goods Received with employer feature bit 262144; CRM2 checks features2.goodsReceivedNotes. Those screen gates are not enforced by these handlers. Mobile receipt routes run separately through the mobile intermediary and have different permission and ownership checks.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_type | Integer | Yes | Presence required, then intval must be nonzero. Exactly 1 selects catalog mode; every other nonzero value selects free-text mode. |
stock_id | Integer | For type 1 | Integer-coerced positive catalog ID. There is no hardcoded item restriction. |
stock_text | String | For other nonzero types | Truthy text; "0" and blank are rejected. Exact SQL equality on stock_text, not substring search. |
Example request
FM_api('PurchasesInDelivered_getOutstanding', ['stock_type'=>'1','stock_id'=>'318']);
Example response
[{"id":"900","cdate":"2026-10-01 09:00:00","amt":"1.5000","po_id":"482","target_id":"0","target_type":"0"}]
If matches exist, each row contains id (PO entry), cdate (PO date), amt (ordered quantity), po_id, target_id and target_type. No delivered sum or remaining quantity is returned.
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: stock_type"} | stock_type omitted, before login. |
{"error":"no stock_type supplied"} | Integer-coerces to zero. |
{"error":"no stock_id"} | Catalog mode stock_id integer-coerces to zero. |
{"error":"no stock_text"} | Free-text mode stock_text is falsey. |
{"error":"goods receipt read failed"} | The outstanding query failed. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Joins each PO entry to an active, non-cancelled purchase order. The returned amt is ordered quantity minus the sum of linked purchases_in_entries.amt_delivered for existing receipt headers, grouped per PO-entry ID by the correlated sum.
- Only positive remaining amounts are returned. Fully received and over-received entries are omitted. Deleted/cancelled POs and orphan receipt lines without a header are excluded. Approval, supplier, owner, department and date are not additional filters.
- Exact item filtering: stock_type=1 and requested catalog ID, or stock_type=2 and supplied free-text description. Each matching PO entry remains separate; order is PO ID then entry ID. No pagination.
- No writes. Receipt deletion remains a separate legacy workflow; retained lines without a header do not reduce this calculation.
See it in Fieldmotion
CRM1
No production CRM1 caller was found. The receiving UI obtains ordered/received quantities through PurchaseOrderEntries_get instead.
CRM2
No production CRM2 caller was found. widgetGoodReceivedEntry also obtains PO entry quantities separately and computes displayed outstanding values client-side.
Related endpoints
PurchasesInDelivered_get— legacy delivered-link rows.GoodsReceived_newNote— current CRM1 receipt writer.