Opportunities
Set an opportunity user
POST
/a/Opportunity_setUser
Replace an opportunity’s assigned-user ID through the legacy inline editor.
When to use this endpoint
Use Opportunity_setUser for CRM1’s User 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 user_id; blank/non-numeric values become zero. |
Example request
$result = FM_api('Opportunity_setUser', [
'id' => '481',
'val' => '18',
]);
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 validate the opportunity/user, active/deleted state, feature, or edit permission. Missing IDs still return success.
Side effects
- Sets
user_id, updateslast_edited, and invalidates the opportunities cache. - Does not create audit history or notifications.
See it in Fieldmotion
CRM1
Click an Opportunities row’s User cell and leave the select to call this route.
CRM2
CRM2’s inline user picker calls Opportunity_updateData with userID.
Related endpoints
Opportunity_setNameis a legacy duplicate with a misleading name.Opportunity_updateDatais the audited CRM2 path.