When to use this endpoint

Use this after changing recurrence timing. InvoiceRecurring_save already invokes it automatically.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session and is scoped to the authenticated tenant.

The handler performs no additional invoice page, record-owner, or department permission check unless stated below.

Parameters

ParameterTypeRequiredDescription
idPositive integerYesExisting recurrence ID.

Example request

$result = FM_api('InvoiceRecurring_recalculateNDate', ['id' => '42']);

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 zero.
{"error":"recurrence does not exist"}No matching tenant row exists.
{"error":"invalid on_arr"}An interval-based recurrence has a non-positive interval.

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

Behaviour and edge cases

  • every=0 selects the next configured weekday; 1 configured zero-based days of a month; 2 configured zero-based days of a year; 3–6 intervals of days, weeks, approximate 30-day months, or approximate 365.242-day years.
  • Interval schedules start from the latest generated invoice date. If none exists, legacy date coercion is used; callers should normally create recurrence links through InvoiceRecurring_save.
  • The selected time is just after midnight in the server timezone and must be later than the current server time.

Side effects

  • Updates ndate and last_edited.
  • Recomputes the global employer account’s invoice_next_recurrence as the tenant’s earliest nonzero next-run time.

See it in Fieldmotion

CRM1

Not called directly by CRM1; recurrence saves invoke it server-side.

CRM2

Not called directly by CRM2; recurrence saves invoke it server-side.

Related endpoints