Goods Received
Read mapped receipt lines
/a/GoodsReceivedEntry_getRequestedDetails
Retrieve line aliases, stock composites and receipt reference metadata.
When to use this endpoint
Retrieve line aliases, stock composites and receipt reference metadata.
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. |
Example request
FM_api('GoodsReceivedEntry_getRequestedDetails', ['grnID'=>'531', 'fields'=>['id','stock','qty','metaReference','metaStorage']]);
Example response
[{"id":"701","stock":{"id":"318","type":"1","text":null},"qty":"2.0000","metaReference":["BATCH-2026-10"],"metaStorage":1}]
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.
- Known receipt aliases are id, grnID, stockType, stockID, stockText, stock, qty, cDate, lastEdited, meta, metaReference and metaStorage. qty means amt_delivered; stock is {id,type,text}, not a name lookup.
- qty filters preserve decimal precision for both scalar equality and native IN lists; an empty quantity list matches nothing. Other numeric detail filters retain the shared integer coercion.
- Nested metadata is decoded to reach reference/storage. Reference can be an array from the receiving widget; null is returned for missing nested keys.
- The line map has no supplierID, grne_id or grt_id fields. Those former aliases referenced nonexistent columns and were removed; supplier linkage is stored on the header. Default all-field reads now use the actual receipt-line schema.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found. CRM1 uses the legacy GoodsReceived_newNote, GoodsReceivedEntries_get and GoodsReceivedNote_* workflow instead.
CRM2
CRM2 receipt widgets request goodsReceivedEntry through the layout helpers. Layout/_map.php names GoodsReceivedEntry_getLayoutDetails as the child reader, but that handler file is absent. Direct GoodsReceivedEntry_getRequestedDetails exists; do not promise that every nested layout read resolves. The header widget expansion calls this existing reader with [id,stock,qty].
Related endpoints
GoodsReceivedEntries_get— CRM1 positional line reader.GoodReceived_getLayoutDetails— parent expansion.