Goods Received
Read receipt layout and line widgets
/a/GoodReceived_getLayoutDetails
Load a receipt layout, including requested entry and card widgets.
When to use this endpoint
Load a receipt layout, including requested entry and card widgets.
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.
Mapped handlers require both a logged-in user and a tenant context before loading the tenant field map.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id, ids | Integer or native array | No | id takes precedence. Values are integer-coerced; an empty ID array adds no ID restriction and can return every row. |
fields | Native array of aliases | No | Defaults to all map aliases, except GoodReceived_getLayoutDetails defaults to an empty list. id is always included; unknown fields are ignored. JSON-encoded text is not decoded here. |
Mapped field aliases | Scalar or native array | No | Additional filters are ANDed. Text equality lowercases the column and trims/lowercases the input; numeric filters use intval. Native arrays become IN filters; empty numeric arrays match nothing. |
order | Alias or native array | No | Detail ordering accepts alias strings or objects such as [{id:"cDate",dir:"desc"}]. Unknown aliases are ignored; no default order. |
advanceSearch | Native rule array | No | Native structured filter rules using mapped field aliases and allowlisted conditions. Raw where clauses and malformed rule shapes are rejected. |
widgetGoodReceivedEntry | Field-list token | No | Include this exact token in fields to attach lines {id,stock,qty}. It is not a scalar receipt-column filter. widgetCard is appended for configured linked cards. |
Example request
FM_api('GoodReceived_getLayoutDetails', ['id'=>'531', 'fields'=>['id','supplierID','notes','widgetGoodReceivedEntry']]);
Example response
[{"id":"531","supplierID":"84","notes":"Delivery received","widgetGoodReceivedEntry":[{"id":"701","stock":{"id":"318","type":"1","text":null},"qty":"2.0000"}],"widgetCard":[]}]
widgetGoodReceivedEntry is omitted when the child lookup is empty; widgetCard reflects requested/configured card data. Its empty value is [] when no card entries are produced.
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. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- This is an unpaginated row list, not a DataTables envelope. Missing IDs are omitted; no match returns []. Database read failures are also collapsed to [], so an empty result is not proof of an absent record.
- No active/deleted or parent-existence filter is added for purchases_in or purchases_in_entries. Neither table is in the shared soft-delete table list. Request native arrays for fields, IDs and nested controls.
- Direct mapped filters intersect. Without a filter the method can read the whole tenant table. limit/start/length do not paginate detail reads.
- Mapped readers reject raw advanced-search SQL, malformed native controls and unsafe sort directions using the same allowlisted query guards as stock/goods returns.
- Omitting fields starts with [], so the base result is id plus widgetCard, not every mapped field. Non-native supplied fields are rejected. Card-linked fields are fetched internally then stripped unless explicitly requested.
- The parent expansion explicitly calls GoodsReceivedEntry_getRequestedDetails with grnID and [id,stock,qty], using the same implemented reader now configured for the child layout. Header reads do not hydrate supplier/PO display names unless configured cards request them.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found. CRM1 uses the legacy GoodsReceived_newNote, GoodsReceivedEntries_get and GoodsReceivedNote_* workflow instead.
CRM2
In CRM2 open Goods Received and a receipt layout, then filter browser requests for Layout_getValue / Layout_setValue. The goodReceived table mapping dispatches header reads to GoodReceived_getLayoutDetails and creates/updates to GoodReceived_createData / GoodReceived_updateData.
Related endpoints
GoodReceived_createDataโ create a mapped header.GoodsReceivedNote_getโ legacy printable supplier/PO fields.GoodsReceivedEntry_getRequestedDetailsโ read line aliases explicitly.