When to use this endpoint

This is the legacy header deletion used by the API test cleanup helper. CRM1’s current delete button uses GoodsReturnedNote_delete instead; CRM2 uses GoodReturned_delete. It is not an undo-return operation.

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 conversion.

Example request

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

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":"invalid or missing parameter: id"}Missing, zero or negative ID.
{"error":"no such goods returned"}The existence lookup returns no row, including a read failure.

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

Behaviour and edge cases

  • Deletes only the goods_returned header. Children remain addressable and stock previously deducted remains deducted.
  • The DELETE result is not checked; ok can be returned after a failed write. A repeated call after successful deletion returns no-such-goods-returned, not idempotent success.

Side effects

  • No explicit goods_returned cache invalidation is requested. No received-note, purchase-order, inventory or total update.

See it in Fieldmotion

CRM1

No direct current page caller found; pageGoodsReturned deletes through GoodsReturnedNote_delete. The test helper cleanupAllGoodsReturned uses this endpoint.

CRM2

CRM2’s goods-return layouts use the goodReturned mapping in php/Layout/_map.php: create/read/update are GoodReturned_createData, GoodReturned_getLayoutDetails and GoodReturned_updateData. The table uses GoodsReturned_getDataTable; its delete action calls GoodReturned_delete.

Related endpoints