When to use this endpoint

CRM1’s return-note view fetches this list after loading GoodsReturnedNote_get. The browser multiplies each unit cost by quantity to display line totals; the API does not calculate those totals.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. Session CSRF and account/IP restrictions still apply. These handlers add no goods-return, finance, department, owner or page-role permission check.

Records belong to the authenticated tenant. CRM1 shows this workflow when the employer features bit 262144 is enabled; CRM2 uses features2.goodsReturnedNotes. These are UI gates, not checks performed by these handlers.

Parameters

ParameterTypeRequiredDescription
idIntegerYesPositive return-header ID after intval, not a line ID. Parent existence is not checked.

Example request

FM_api('GoodsReturnedEntries_get', ['id'=>642]);

Example response

[["1","1042","Example stock","2","744","12.50"]]

Tuple positions: stock type, catalog stock ID, description, integer quantity, return-line ID and original purchase unit cost_net. Database values remain strings/nulls; no linked purchase entry can produce false for the cost.

Catalog name lookup failures/blank names become "UNKNOWN". Free-text descriptions return the saved stock_text, including quotes and literal markup.

Errors and unusual responses

ResponseCondition
{"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"}Missing, zero or negative-converted ID.
{"error":"goods return read failed"}Line 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

  • Reads all lines with grt_id=id; no paging, sorting, quantity filter or parent existence validation. Empty/no lines yields []; orphan lines can remain visible after header deletion.
  • Catalog type 1 uses current stock.name without deletion/archive filtering. Other types return saved stock_text; the obsolete hyphenated-key lookup is corrected.
  • Unit cost is looked up through grne_id → purchases_in_entries.poe_id → purchase_order_entries.cost_net, not stored return/header totals. Each line adds separate name/cost queries; a missing link does not reject the line.
  • A failed line query returns {"error":"goods return read failed"} rather than iterating false.

Side effects

  • Read only. No stock movement, stored total recalculation or audit write.

See it in Fieldmotion

CRM1

pageGoodsReturnedNote calls this after header load, computes net line totals from tuple quantity × unit cost and adds delivery figures locally.

CRM2

Mapped layouts use the now-available GoodsReturnedEntry_getLayoutDetails delegate rather than this tuple reader.

Related endpoints