When to use this endpoint

Use MarketingExpense_setExpenseDate only for CRM1 compatibility. Prefer a mapped update for strict date validation.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but performs no additional Marketing-page, create, edit, delete, or role-permission check.

All reads and writes use the authenticated tenant’s tables. CRM1 and CRM2 hide some controls through client-side permissions; these routes do not repeat those UI checks.

Parameters

ParameterTypeRequiredDescription
idNumeric SQL valueYesExpense-row ID. Presence only is checked; send a positive integer string.
valDate stringYesReplacement date. CRM1 sends YYYY-MM-DD, but this endpoint performs no format validation.

Example request

$result = FM_api('MarketingExpense_setExpenseDate', [
	'id' => '7124',
	'val' => '2026-10-15',
]);

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.
{"error":"missing or invalid parameter: val"}val is absent.
{"ok":1}The ID is unknown or the database rejects/coerces the date; the query result is ignored.

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

Behaviour and edge cases

  • An attempted update advances the server Unix last_edited timestamp.
  • No existence or no-change check is performed.

Side effects

  • Requests marketing-expense cache invalidation but writes no Core history.

See it in Fieldmotion

CRM1

Open Settings → Marketing → Expense in CRM1 and filter browser developer tools for the exact function name. Click an Expense Date cell, choose a date, and leave the date picker.

CRM2

CRM2 uses the mapped update route.

Related endpoints