Requisition orders
Create a legacy requisition header
/a/RequisitionOrder_new
Create an Open requisition before adding its material lines.
When to use this endpoint
Use the CRM1 header workflow: select the requesting user, create the header, then create/save entries. This does not copy Quote stock or allocate inventory.
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 |
|---|---|---|---|
user_id | Integer-compatible | Yes | Active tenant requester ID; -1/0 are accepted as legacy unassigned sentinels. It is independent of the authenticated actor. |
description | String | Supply explicitly | Optional text up to 65,535 bytes. Blank and string "0" are accepted; no trimming. |
Example request
$result = FM_api('RequisitionOrder_new', [
'user_id' => '104',
'description' => 'Materials for north site',
]);
Example response
{"ok":1,"id":1042}
An exact no-op header setter may include warning:"No Change.". Committed follow-up failures include saved=1 and a warning; inspect saved state before retrying.
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
- Creates a new Open header with server creation/edit timestamps, zero line totals and no approval or line items. Validates positive requester references; -1/0 preserve legacy unassigned callers.
- There is no replay key: repeated successful requests create separate headers.
- 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.
- Follow-up notifications and mentions run after the owning commit. If a follow-up fails after persistence, the response includes saved=1 and a warning; read the saved object before retrying and do not replay creation.
Side effects
- Checked header/totals/history writes with last_edited and deferred notifications/mentions/cache invalidation. Delivery remains separate from line totals; ordinary edits retain approval.
See it in Fieldmotion
CRM1
In CRM1 Requisition Orders choose Create, select User and enter Description; filter for RequisitionOrder_new. Quote → create requisition also uses it.
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_new— Create an empty line for the returned header.RequisitionOrder_createData— Use the mapped creation contract instead.