Requisition orders
Create an empty legacy requisition line
/a/RequisitionOrderEntry_new
Create a blank line on an editable requisition.
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 Add 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 |
|---|---|---|---|
ro_id | Positive integer | Yes | Existing visible, non-deleted parent in an editable status. Other material inputs are ignored until save. |
Example request
$result = FM_api('RequisitionOrderEntry_new', [
'ro_id' => '1042',
]);
Example response
{
"ok": 1,
"id": 2088
}
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
On CRM1 Requisition details select a row’s item type. It calls RequisitionOrderEntry_new and retries saving until it receives an ID, then calls save.
CRM2
No direct caller was found in CRM2 source. Its requisition screen uses mapped layout reads/writes instead of this legacy endpoint.
Related endpoints
RequisitionOrderEntry_save— Populate the blank row.RequisitionOrderEntry_createData— Use mapped creation instead.