Email imports: configuration and diagnostics
Rename a job email-import configuration
/a/ImportJobsEmail_setName
Rename a job email-import configuration
When to use this endpoint
Give a job email-import configuration a recognizable list label without replacing its extraction rules or recipient.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. The handler calls Core_requireLogin(); it has no separate page, administrator, or role-permission check.
The account must have Import By Email enabled (employer|features bit 32768). There is no separate page, administrator, or role-permission check in these handlers.
The shared mutation helper selects the global database explicitly and locks the authenticated tenant owner and selected configuration rows. Every target must belong to that tenant and match this route’s configuration type: 0 job, 1 customer, or 2 task. Missing, foreign-owned, and wrong-type targets return the same that import does not exist error (the capture setter retains its dedicated not-found message).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer | Yes | Positive global configuration ID. The shared mutation helper requires a complete positive integer value, not a malformed or fractional string accepted only by intval. Missing, zero, negative, and invalid IDs are rejected. |
name | String | Yes | Trimmed, nonblank label, at most 64 bytes. PHP also rejects the string "0" as false. The limit is bytes, not Unicode characters. |
Example request
$result = FM_api('ImportJobsEmail_setName', [
'id' => '1042',
'name' => 'Website enquiries',
]);
Example response
{"ok":1}
Changed values return {"ok":1}. An unchanged trimmed value returns {"ok":"1","warning":"no change required"}, without changing the timestamp or history.
A committed global write whose later tenant history write fails returns success with saved:1 and a warning; do not replay it.
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"} | Nonpositive integer-converted ID, before authentication. |
{"error":"missing or invalid parameter: name"} | Omitted, blank after trimming, or the string "0", before authentication. |
{"error":"parameter name too long. max length 64"} | The trimmed value exceeds 64 bytes, before authentication. |
{"error":"Import By Email feature not enabled"} | The account feature bit is disabled. |
{"error":"that import does not exist"} | No row of this family owned by the authenticated tenant was found. Bulk edits preflight every selected row before writing. |
{"error":"email import write failed"} | A checked global write or insert-ID retrieval failed; the global transaction is rolled back. |
{"error":"email import read failed"} | The checked lookup failed; no configuration write is committed. |
{"error":"email import transaction failed"} | Beginning or committing the global transaction failed. Inspect the configuration before retrying an uncertain commit. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Names need not be unique. The focused setter trims input, rejects blank/false-like text and enforces the 64-byte maximum. It changes neither extraction rules nor recipient.
- No-op comparison returns before the configuration write and history queueing. Missing and foreign/wrong-type IDs are errors, including on the job-family setter.
Side effects
- The primary configuration write uses checked global persistence, advances Unix-seconds
last_edited, and requestsimport_filterscache invalidation. A changed write and any global feature-marker update commit together; a failure rolls back the global transaction. - Change history is written to the authenticated tenant after the global commit, once per changed configuration. These are separate database contexts, not an atomic cross-database audit. If history fails, the committed result includes
saved:1and a warning to avoid replaying the write. For a SQL-string deletion response, the warning result is an object withok:1and the original string underresult. - No mailbox is fetched and no business object is imported synchronously by this configuration mutation.
See it in Fieldmotion
CRM1
In Imports → Jobs by Email, edit the Name cell. Filter for ImportJobsEmail_setName; this family sends name.
CRM2
The Jobs by Email table uses the shared editable-column machinery with prefix ImportJobsEmail. Its inline Name editor constructs ImportJobsEmail_updateField, not this focused setter.
Related endpoints
- ImportJobsEmail_getDetails: inspect the stored configuration before changing it.
- ImportJobsEmail_save: create or save the configuration using the focused legacy workflow.