When to use this endpoint

Calculate delivery amounts in the client and send all three fields. delivery_tax is an amount, not a percentage; a tax-code string does not calculate it.

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

ParameterTypeRequiredDescription
idPositive integerYesExisting, non-deleted requisition ID in the authenticated tenant and your record scope.
delivery_netNumeric textYesFinite nonnegative amount up to 99,999,999.99, rounded to two decimal places. The tax amount is explicit; the server does not derive it from a text tax code.
delivery_taxcodeStringYesRequired presence, blank allowed; stored label/code with no catalogue validation.
delivery_taxNumeric textYesFinite nonnegative amount up to 99,999,999.99, rounded to two decimal places. The tax amount is explicit; the server does not derive it from a text tax code.

Example request

$result = FM_api('RequisitionOrder_setDeliveryCosts', [
	'id' => '1042',
	'delivery_net' => '10.00',
	'delivery_taxcode' => 'VAT20',
	'delivery_tax' => '2.00',
]);

Example response

{"ok":1}

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

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":"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

  • Writes delivery net, explicit tax amount and tax-code label together using bound values. Nonnegative finite amount validation replaces raw SQL interpolation.
  • Header total_net/total_tax remain the line aggregates; carriage is separate. No tax-code catalogue lookup, rate consistency calculation or approval reset is performed.
  • 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

On CRM1 Requisition details change Carriage Net, Tax Code or Tax; filter for RequisitionOrder_setDeliveryCosts.

CRM2

No direct caller was found in CRM2 source. Its requisition screen uses mapped layout reads/writes instead of this legacy endpoint.

Related endpoints