Opportunities
Set an opportunity value
POST
/a/Opportunity_setValue
Replace an opportunity’s integer value through the legacy inline editor.
When to use this endpoint
Use Opportunity_setValue for CRM1’s Value column. New code should prefer the mapped updater.
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 | Opportunity ID after integer conversion. |
val | Integer string | Yes | Replacement integer value. Decimals are truncated; blank/non-numeric values become zero. |
Example request
$result = FM_api('Opportunity_setValue', [
'id' => '481',
'val' => '2500',
]);
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"} | id is omitted. |
{"error":"missing or invalid parameter: val"} | val is omitted. |
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 handler does not check row existence, deleted state, feature, or edit permission. Missing IDs still return success.
- Negative values are accepted; no currency/precision validation occurs because the database column is an integer.
Side effects
- Sets
value, updateslast_edited, and invalidates the opportunities cache. - Does not create audit history or notifications.
See it in Fieldmotion
CRM1
Click an Opportunities row’s Value cell and leave the number input to call this route.
CRM2
CRM2 edits the mapped value field through Opportunity_updateData.
Related endpoints
Opportunity_updateDatais the audited CRM2 path.Opportunity_convertToQuotecopies the stored value into the quote net/profit totals.