Marketing
Rename a lead source
/a/MarketingSource_setName
Rename one lead-source option from CRM1’s inline-editable Source table.
When to use this endpoint
Use MarketingSource_setName only for the legacy single-field edit. The mapped update routes provide change detection and Core history.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but performs no additional Marketing-page, create, edit, delete, or role-permission check.
All reads and writes use the authenticated tenant’s tables. CRM1 and CRM2 hide some controls through client-side permissions; these routes do not repeat those UI checks.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive marketing-source ID. |
val | String | Yes | Trimmed nonempty replacement name, maximum 100 characters. |
Example request
$result = FM_api('MarketingSource_setName', [
'id' => '30124',
'val' => 'Industry conference',
]);
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 is absent or not positive after integer conversion. |
{"error":"missing or invalid parameter: val"} | val is absent or trims to blank. |
{"error":"parameter too long: val. max length 100 characters"} | The replacement exceeds 100 characters. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- An unknown positive ID still returns
{"ok":1}. - The route does not check for duplicate names or whether the value changed.
- A matching row receives the current server Unix
last_editedvalue.
Side effects
- Invalidates the marketing-source cache. It does not write Core history.
See it in Fieldmotion
CRM1
Open Settings → Marketing → Source in CRM1 and filter browser developer tools for the exact function name. Click a Name cell, edit it, then leave the field; CRM1 calls this endpoint on blur.
CRM2
CRM2 uses MarketingSource_updateData for editable table cells.
Related endpoints
MarketingSource_updateFieldis the mapped single-field alternative.MarketingSource_getRequestedDetailsverifies the stored result.