When to use this endpoint

Edit receipt-line metadata without adjusting received stock.

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

ParameterTypeRequiredDescription
idInteger or native arrayYesReceipt-line ID(s), not header IDs.
grnIDIntegerNoReceipt-header ID, integer-coerced. Parent existence is not validated by this mapped write. Supplier belongs to the header, not this line map.
stockNative objectNoComposite {id,type,text} expands to stockID, stockType, stockText. UI uses type 1 catalog stock and 2 free text; the server does not validate that enum or the catalog record.
stockID, stockType, stockTextInteger / textNoDirect composite components. Text replaces stock_text; IDs use intval. The line retains the provided description rather than looking up a current stock name.
qtyDecimalNoNon-negative amount delivered, up to four decimal places after tenant upgrade 798. Invalid, negative, non-finite, excessively large or over-precision input is rejected. This metadata-only write does not move stock.
cDate, lastEditedDate/time stringNocDate defaults to server now on creation. Edit timestamps are automatically added. Datetime strings are not strictly validated; blank becomes SQL NULL.
metaJSON text or native objectNoWhole meta replacement; no schema validation or merge.
metaReference, metaStorageText or native structured valueNoNested meta.reference / meta.storage aliases preserve other metadata. The receipt workflow stores reference as an array and storage as an ID; this map labels both text.
noRecord, noRecordCustomNative arraysNoHistory-hidden controls, not a way to skip persistence or permissions.

Example request

FM_api('GoodsReceivedEntry_updateData', ['id'=>'701', 'qty'=>'2']);

Example response

{"ok":1}

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":"Unable to update record"}Database persistence failed; bulk updates may already have committed a prefix.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Mapped integer fields use intval; UI hidden/readonly metadata is not a server authorization rule. Unmapped keys are ignored. The literal string null is treated as SQL NULL even for ordinary text, while omitted/null keys are generally skipped by isset.
  • Scalar updates compare converted values and return {"warning":"No Change."} if unchanged. Missing targets return {"warning":"No data."}; unknown-only changes return {"warning":"no updated fields."}. An id-only request returns {"ok":1}. These warnings are not errors.
  • Native id arrays are processed sequentially, not transactionally. A write error stops the loop and returns updatedIds (the processed prefix) and failedId; prior changes remain. Warning-only rows count as processed; an empty list returns ok.
  • Changed writes invalidate the mapped table cache, advance last_edited and append field/custom-value history after persistence. History is not part of an all-or-nothing transaction.
  • Direct po_id and poe_id are not mapped aliases and are ignored. Former supplierID/grne_id/grt_id aliases are also unmapped; they cannot write nonexistent line columns.
  • Neither route creates inventory, movement history, PO fulfillment calculations or catalog quantity changes. Updating grnID can move a line between headers without ownership/parent checks.
  • 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.

Side effects

  • Mapped line insert/update, purchases_in_entries cache invalidation, edit timestamp and field history; no catalog/inventory movements.

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.

Related endpoints