Marketing
Create a legacy lead source
/a/MarketingSource_new
Create a named lead-source option through CRM1’s compact Source dialog.
When to use this endpoint
Use MarketingSource_new for compatibility with CRM1’s quick-create flow. Use the mapped create route when the new ID or Core field history is needed.
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 |
|---|---|---|---|
name | String | Yes | Trimmed nonempty source name, maximum 100 characters. |
Example request
$result = FM_api('MarketingSource_new', ['name' => 'Trade show']);
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: name"} | The key is absent or trims to an empty string. |
{"error":"parameter too long: name. max length 100 characters"} | The name 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
- The route does not return the inserted ID. Fetch the list or use
MarketingSource_createDatawhen the ID is required immediately. - No duplicate-name check is performed.
- Creation and edit timestamps are both set to the current server Unix time.
Side effects
- Inserts the tenant source row and invalidates the marketing-source cache. It does not write mapped Core field history.
See it in Fieldmotion
CRM1
Open Settings → Marketing → Source in CRM1 and filter browser developer tools for the exact function name. Choose Create, enter the new lead-source name, and submit the dialog.
CRM2
CRM2’s generic Lead Source page uses MarketingSource_createData, not this legacy route.
Related endpoints
MarketingSource_createDatareturns the new ID and records fields.MarketingSource_setNamesupports CRM1 inline renaming.