Goods returns
Delete mapped return lines
/a/GoodsReturnedEntry_deleteData
Physically delete matching return lines with a deletion audit, without restoring stock.
When to use this endpoint
Use the mapped line deletion path with a precise line ID. Removing a line is not an inventory reversal and does not repair the parent header 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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer or native array | One filter required | Recommended exact ID selector; a native array matches IDs in that list. This helper does not use the ids alias. |
Other mapped aliases | Scalar or native array | Alternative filters | Any mapped column can restrict deletion. Text uses exact equality or membership (not trimmed substring search); numeric scalars use intval and numeric arrays use typed conversion. Different aliases are ANDed. Broad filters can delete multiple records. |
Example request
FM_api('GoodsReturnedEntry_deleteData', ['id'=>744]);
Example response
{"ok":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. |
{"error":"missing or invalid filter"} | No recognized mapped column filter was supplied. |
{"error":"Could not read records for deletion. Please retry."} | Selecting the rows fails. |
{"error":"Could not delete records. Please retry."} | The physical delete query fails. |
{"error":"Could not record deletion audit."} | Deletion already happened, but recording its audit failed. Retrying cannot restore those records. |
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 table is not in DataProcessClass’s soft-delete table set: the helper physically deletes rows, not
deleted=1. No migration is performed by the request. - No matching records is a successful
{"ok":1}. Unknown keys are ignored; at least one recognized filter is still required. - Reads, deletion and audit are separate operations, not a transaction. Do not treat deletion success as recoverable soft deletion.
- Filters use entry aliases: id, grtID, grnID, stockType, stockID, stockText, stock, qty, cDate, lastEdited and grne_id. Use scalar aliases to select stock; this deletion helper does not expand the composite stock object.
- A grtID filter can delete every child for one header. The header itself remains and its timestamp/totals are not touched. Quantities previously deducted by GoodsReturned_new are not restored.
Side effects
- Invalidates goods_returned_entries cache and logs matched IDs/rows in tenant deletes plus a Core_log delete event after the write. Audit failure can follow successful physical deletion.
- No inventory/container transaction, parent-header edit or received-note adjustment.
See it in Fieldmotion
CRM1
CRM1 returns lines through GoodsReturned_new; no direct mapped line-delete button was found in its goods-return pages.
CRM2
CRM2’s goodsReturnedEntry layout mapping selects this mapped line family for create/update/delete. Its configured read name is GoodsReturnedEntry_getLayoutDetails, but that handler does not exist; this available reader is GoodsReturnedEntry_getRequestedDetails. Do not assume nested layout reads are working.