When to use this endpoint

Use the user/type/year identity from the target table when removing an entire annual target allocation. To change one month without removing the year, use the monthly setter.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session; all rows belong to that tenant.

Employer feature bit 8192 is required by both target feeds and mutations. No additional page-role, department, ownership, or target-user permission check is enforced.

For signed form requests, sign numeric scalar values as strings, including values inside native nested arrays. Send JSON text only for parameters explicitly accepting JSON strings; see Getting started.

These reporting handlers require tenant schema upgrade 794 before deployment. No request path creates or repairs schema.

Parameters

ParameterTypeRequiredDescription
typeInteger-compatibleYesCRM target editors use 0 Quote Won, 1 Invoice Paid, 2 Job, and 3 Opportunity. The handler does not enforce this list. Must be a nonnegative integer; fractional or malformed values are rejected.
yearInteger-compatibleYesTarget calendar year. No range validation. Must be a nonnegative integer; fractional or malformed values are rejected.
userIDInteger-compatibleYesUser ID. This endpoint does not validate user existence.

Example request

$result = FM_api('ReportsTarget_delete', ['userID'=> '7','type'=> '0','year'=> '2026']);

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: type"}Required type is absent or invalid.
{"error":"missing or invalid parameter: year"}Required year is absent or invalid.
{"error":"missing or invalid parameter: userID"}Required userID is absent or invalid.
{"error":"no permission to access api"}Employer feature bit 8192 is unset.
{"error":"reporting write failed"}A database write failed. Transactional operations roll back instead of returning success.
{"error":"reporting deletion could not be recorded"}The deletion audit failed; the entire soft deletion is rolled back.

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

Behaviour and edge cases

  • userID=0 means literal user zero, not all users. Every active matching month, including duplicate rows, is soft-deleted.
  • No active match still succeeds without a new audit. Records are retained but excluded from table feeds and target-attainment/gauge calculations; no reporting restore endpoint exists.
  • Numeric inputs are validated before SQL. Row deletion metadata and per-row tenant audits commit together; audit failure rolls back everything.

Side effects

  • Sets deleted=1 and Unix deletion/edit times for matching rows, invalidates the target cache, and writes a deletion audit for each active monthly row. No history or notification occurs.

See it in Fieldmotion

CRM1

The Report Target page uses this endpoint for its annual target Delete action. Filter browser Network requests for ReportsTarget_delete.

CRM2

Report Targets classic/new editors use this endpoint for deleting an annual user/type row. Filter browser Network requests for ReportsTarget_delete.

Related endpoints