When to use this endpoint

Use Opportunity_updateData for CRM2 layout saves and inline edits. It accepts the same mapped keys as Opportunity_createData and changes only supplied fields.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesTarget opportunity ID. The shared helper supports a native ID array for ordinary updates, but this wrapper’s quote/notice/notification logic assumes one ID; use one ID per call.
user / customer / quoteIDNative objects/arraysNoPicker values with nested id, expanded to userID, customerID, or quote. The scalar aliases can be supplied directly.
value / notes / status / source / typeMapped integer/text valuesNoCore editable values. Status integer 3 triggers quote creation before the mapped update.
formID / formValues / subformValuesInteger / JSON-compatible valuesNoOpportunity form and complete main/subform documents.
widgetFormFieldJSON-compatible valueNoCopied to formValues and takes precedence over a separately supplied value.
createDate / lastEditedUnix seconds or parseable datetimeNoMapped epoch fields. Any actual change also refreshes last_edited to the current epoch, overriding a supplied historical value in the generated SQL.
isStarred / reason / formID / createdBy / deletedInteger-compatibleNoOther mapped scalar fields. Read-only/hidden layout flags are not enforced server-side.
customValuesJSON-compatible valueNoComplete mapped custom-values document.
metaCallback / metaCallbackNotes / metaJobDatetime / text / textNoValues merged into the stored meta JSON object.
noRecord / noRecordCustomNative arraysNoField/custom keys whose audit metadata should be hidden.
_pollAnyNoIgnored before the mapped update.

Example request

$updated = FM_api('Opportunity_updateData', [
	'id' => '481',
	'value' => 2750,
	'notes' => [['text' => 'Repriced after survey']],
]);

Example response

{
  "ok": 1,
  "oldData": {
    "value": "2500",
    "notes": "Initial estimate"
  }
}

When status 3 creates a quote, the response also contains numeric quoteId. oldData includes only stored columns selected for supplied mapped fields and uses their first mapped aliases.

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. This is also returned before conversion when status is 3.
{"warning":"no updated fields."}No supplied key maps to a writable stored field.
{"warning":"No data.","oldData":[]}The ID has no non-deleted row for the selected mapped fields.
{"warning":"No Change."}Mapped values compare equal after type/JSON normalization.
Quote-creation errorStatus 3 was supplied and the quote helper rejected the opportunity’s user/customer or could not insert a quote.

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

Behaviour and edge cases

  • Soft-deleted rows are excluded by the mapped helper. Unknown keys are ignored; numbers are converted to mapped numeric types; JSON documents are compared structurally.
  • Layout required/read-only flags are not general authorization. A supplied blank required quoted value is rejected, but related IDs, feature state, and CRM2 edit permission are not server-validated.
  • In a CRM2 session, the internal conversion returns the quote ID without first setting legacy status 2; the outer update stores status 3 and quote_id. Other session types may briefly write 2 before the outer write stores 3.
  • Warning/no-data responses still pass through the wrapper’s mention/notification calls using the submitted data, even though no mapped row changed.

Side effects

  • On change, updates mapped columns/last_edited, invalidates the opportunities cache, and writes per-field audit entries.
  • Scans notes-compatible submitted fields for newly mentioned users, then queues opportunity update/time notifications using normalized old/new notes.
  • Status 3 creates and audit-logs a draft quote before the mapped update.

See it in Fieldmotion

CRM1

CRM1 uses individual legacy setters rather than this mapped route.

CRM2

Layout create/edit, inline user/notes/status edits, callback saves, job-link creation, and Kanban moves all derive this route from table opportunity.

Related endpoints