Opportunities
Set opportunity notes
/a/Opportunity_setNotes
Replace one opportunity’s legacy notes value, avoiding a write when it is unchanged.
When to use this endpoint
Use Opportunity_setNotes for CRM1’s inline Notes editor. CRM2 uses the mapped updater so it can process structured notes and mentions.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Positive opportunity ID. |
val | String | Yes | Complete replacement notes value; blank is allowed. |
Example request
$result = FM_api('Opportunity_setNotes', [
'id' => '481',
'val' => 'Call before pricing',
]);
Example response
{
"ok": 1
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"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"} | The ID integer-converts below one. |
{"error":"missing or invalid parameter: val"} | val is omitted. |
{"error":"opportunity does not exist"} | No row has that ID. Soft-deleted rows do count as existing. |
{"ok":"1","warning":"no change required"} | Loose comparison says the supplied and stored notes are equal. |
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 route reads and updates soft-deleted rows as well as live ones.
- Notes are stored as a text value; this legacy route does not parse or normalize CRM2 structured-note JSON.
Side effects
- On change, updates
notes/last_editedand invalidates the opportunities cache. - Does not write generic audit history, send mention notices, or queue opportunity notifications.
See it in Fieldmotion
CRM1
Click an Opportunities row’s Notes cell and leave the editor to save through this route.
CRM2
Inline notes use Opportunity_updateData, including structured-note normalization for side effects.
Related endpoints
Opportunity_updateDataprovides audited/notification-aware notes updates.Opportunity_getreturns the stored notes string.