Requisition orders
Update a mapped requisition line
/a/RequisitionOrderEntry_updateData
Update a mapped line while preserving its parent and allocated quantities.
When to use this endpoint
Use the legacy blank-line/save flow for CRM1, or mapped creation/update for layout clients. Keep the line and its parent IDs together. A full CRM2 spreadsheet save uses Layout_setValue so header and all replacement lines commit together.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. API keys use their owner’s tenant; session dispatch applies CSRF checks. Office requisition access requires View and Edit on Requisition Order or Requisition Orders. A visible UI control is not sufficient authorization.
Tenant and TeamAccess/legacy department scope apply to headers and to the parent of each line. Deleted parents hide their lines. Scoped users can see their own unlinked requisitions; the legacy department-only rule retains its target-based visibility. There is no additional Requisition feature-entitlement check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer | Yes | Existing line ID for update; creation always allocates a new ID. |
roID | Positive integer | No | Visible editable parent. An update defaults to the line’s existing parent and cannot move it. |
stock / stockID, stockType, stockText | Native object / components | Yes on creation | stock={id,type,text}; type=1 existing unarchived non-deleted stock, type=2 nonblank miscellaneous text of at most 255 bytes. Component aliases are accepted. An update may omit unchanged material fields. |
supplierID, qty | Integers | No | Supplier 0 is unassigned; positive suppliers must exist and be active. qty is nonnegative whole-number input; fractions fail. Creation defaults quantity to zero. |
costNet, totalNet, totalTax | Amounts | No | Finite nonnegative money. costNet and totalTax default to zero on creation; totalNet is calculated as qty × costNet regardless of the submitted value. Tax remains explicit. |
taxType / taxTypeID | Native object / string | No | Tax picker {id,nominalID}, or a code string up to 32 bytes. The nominal component is normalized separately; no tax-rate lookup/recalculation. |
nominal_id, nominalID, nominal_code, nominalCode, nominal | Integer/string | No | Canonical or legacy Account identity; conflicting explicit matches fail. The accounting code is stored. |
cDate, lastEdited, poeID | Read-only metadata | No | Ignored on these writes. Creation/edit timestamps are server-authored; these endpoints do not attach a Purchase Order entry. |
noRecord, noRecordCustom | Native or JSON array | No | Optional history redaction controls; omit for normal writes. They do not suppress the audit record. |
Example request
$result = FM_api('RequisitionOrderEntry_updateData', [
'id' => '2088',
'qty' => '3',
'totalNet' => '37.50',
'totalTax' => '7.50',
]);
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":"permission denied"} | Required office page/action access is absent. |
{"error":"requisition order does not exist"} | The header is missing, deleted or outside the caller’s scope. |
{"error":"Processed requisitions are read-only"} | A material/header edit targets status 2. |
{"error":"Unable to save requisition. Check the saved state before retrying."} | A checked database/audit operation failed; verify saved state before replaying an uncertain request. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Nominal storage remains the accounting code. Explicit nominal_id/nominalID resolve local Accounts; nominal_code is an explicit code. Legacy nominal/nominalCode and taxType.nominalID resolve a matching code before treating a numeric value as an Account ID. Conflicting explicit ID/code matches return an error. Unknown legacy text can remain a code. Reads add nominal_id (integer) and nominal_code (string), normalize nominalCode to the local ID when selected, and normalize taxType.nominalID to that ID.
- Blank-line creation inserts only its parent and server timestamps/defaults; extra material fields are ignored. Material creation/update validates references and nonnegative whole quantities. A missing row or wrong parent returns an error.
- The server calculates line net from quantity × unit cost; tax is the explicitly supplied amount. It sums stored line net/tax into the parent; delivery charges remain separate. Existing approval is retained.
- Rebuilds only the parent’s unallocated initial containers (type 15), preserving allocations at their existing destinations. Changing material identity or reducing below allocated quantity fails atomically. No physical inventory movement occurs.
- The header/line changes, aggregate totals and audit are checked in one tenant transaction. A failed write or audit rolls back the operation. Existing caller transactions use savepoints; the caller owns final commit. No request key deduplicates creation.
Side effects
- Writes line/history, recalculates parent totals and last_edited, reconciles initial containers and invalidates line/header caches in the same operation. A full Layout_setValue replacement defers reconciliation until every replacement line is valid.
See it in Fieldmotion
CRM1
No direct caller was found in CRM1 source. Its requisition screen uses the legacy header/line endpoints instead.
CRM2
No direct RequisitionOrderEntry_updateData call was found in CRM2’s full-sheet save path; that path deletes/recreates lines. Generic mapped row editing can derive RequisitionOrderEntry_updateData; filter for Layout_setValue or the widget’s row request.
Related endpoints
RequisitionOrderEntry_getRequestedDetails— Read canonical line/nominal values.RequisitionOrderEntry_new— Use the separate CRM1 empty-row workflow.RequisitionOrder_updateData— Save independently calculated header totals.