When to use this endpoint

Use Contract_setBudget for the inline Budget cell on the CRM1 Contracts table.

For CRM2 layout saves, update the mapped budget field through Contract_updateData.

Authentication and permissions

The request must establish an authenticated tenant context. The handler checks DBP but does not separately require a user ID or role.

No contract existence, page-permission, or ownership check is performed.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive contract ID. The route does not verify a row exists or exclude a soft-deleted row.
valScalarYesValue written to the floating-point budget column through a quoted SQL value. The handler performs no numeric, range, or precision validation.

Example request

$result = FM_api('Contract_setBudget', [
	'id' => '720',
	'val' => '25000.00',
]);

Example response

{
  "ok": 1
}

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":"missing or invalid parameter: id"}The ID is absent or nonpositive.
{"error":"missing or invalid parameter: val"}The val key is omitted. Blank is present and therefore accepted.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • The database determines how nonnumeric, over-precision, and out-of-range text is coerced into the float column.
  • There is no no-change shortcut, filtering, or pagination.

Side effects

  • Updates budget and last_edited when the row matches, then writes a contract audit entry even when no row matched.
  • This route does not explicitly invalidate the contracts cache.

See it in Fieldmotion

CRM1

Edit the Budget cell on the Contracts page and filter Network requests for Contract_setBudget.

CRM2

No direct production CRM2 call was found; CRM2 uses the mapped update route.

Related endpoints