When to use this endpoint

Replace the receipt supplier invoice reference from CRM1.

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

ParameterTypeRequiredDescription
idIntegerYesReceipt header ID; must integer-coerce to at least 1.
valStringYesWhole replacement value; blank clears the column. Omitted/null is rejected; no append, uniqueness or supplier check.

Example request

FM_api('GoodsReceivedNote_setSupplierInvoiceNo', ['id'=>'531', 'val'=>'INV-1042']);

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":"missing or invalid id"}id omitted/invalid/below 1.
{"error":"no supplier invoice number supplied"}val omitted/null.
{"error":"goods received note does not exist"}Header lookup returned no row (including read failure).
{"error":"goods receipt write failed"}Checked update/history persistence failed; transaction rolls back.

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

Behaviour and edge cases

  • Locks the target receipt and compares the raw replacement text with the stored value. An unchanged quoted/backslash-containing value is a no-op and returns {"ok":1,"warning":"no change needed"}.
  • Changed text, server last_edited and field history commit atomically. A failed read/write/history/commit returns an error and rolls back; the receipt cache is invalidated.
  • Blank text clears the column. There is no append/merge, uniqueness or supplier validation. No stock, receipt-line or PO status change, and no mention-notification helper.

Side effects

  • Checked receipt text/edit-timestamp/history write with receipt cache invalidation. A no-op does not change the timestamp or add history.

See it in Fieldmotion

CRM1

In Goods Received click the Supplier Inv # cell and save its editor. Filter developer tools for GoodsReceivedNote_setSupplierInvoiceNo; the UI submits id and val.

CRM2

No direct CRM2 caller was found. CRM2 edits suppInvoice through GoodReceived_updateData / Layout_setValue.

Related endpoints