When to use this endpoint

Use Asset_setWarranty for the warranty-date field on a known asset.

Send the date as YYYY-MM-DD. Unlike asset creation, this setter does not accept spreadsheet date serials or a blank value to clear the field.

Authentication and permissions

The handler requires an authenticated tenant context, established by signed API-key fields or a CRM session. It checks the tenant table prefix but does not separately require a logged-in user ID.

No page, role, or asset permission is checked.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive server-side asset ID. The handler does not verify that the row exists and does not exclude soft-deleted rows.
valDate stringYesExactly four digits, hyphen, two digits, hyphen, two digits. The regular expression checks shape only; it does not validate that the month/day form a real calendar date.

Example request

$result = FM_api('Asset_setWarranty', [
	'id' => '4821',
	'val' => '2027-09-24',
]);

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"}id is absent or does not convert to a positive integer.
{"error":"val must be in YYYY-MM-DD format"}val is omitted or does not match the required digit-and-hyphen shape.

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 endpoint has no no-change shortcut; resubmitting the same date still updates last_edited and writes an audit entry.
  • It does not create an asset_changes history row, including when the date changes.
  • The update has no archived or deleted filter.
  • This is a single-record mutation; it provides no list filtering or pagination.

Side effects

  • Attempts to update warranty and last_edited, sets edited_uuid to Asset_setWarranty, invalidates the asset cache, and writes an asset audit entry.

See it in Fieldmotion

CRM1

Edit Warranty on the Assets table, asset edit page, or customer Assets tab and filter Network requests for Asset_setWarranty. CRM1’s date input supplies the ISO-shaped value.

CRM2

No direct production CRM2 call to Asset_setWarranty was found; CRM2 uses its broader update contract.

Related endpoints

  • Asset_get returns the stored warranty date.
  • Asset_new accepts either an ISO-shaped date or a spreadsheet date serial during creation.