MngUpdateLeadsAssignedManagerByFilter¶
Sets assigned_manager_id, the CRM owner, for every lead matching the supplied
filter.
The confirm flag decides whether anything is written. With confirm: false the
command runs every check and returns the counters describing what would happen,
without touching a record. With confirm: true the same run also persists the
change. The response shape is identical in both modes.
The command is available through the manager command API only; there is no REST
path for it. The kind is fixed by the command name, so customer_kind is not
accepted on input. See
Clients and Leads Commands.
It replaces the deprecated MngUpdateCustomersAssignedManagerByFilter.
Access Control¶
Allowed sessions:
SESSION_MANAGERSESSION_ADMINSESSION_DEALERSESSION_CRM_MANAGERSESSION_CRM_ADMIN
The caller must have CRM access and set_leads. The requested deskFilter is first
narrowed to the desks the caller may see, and then every selected record is
checked individually against the caller's brand and desk scope. Records outside
that scope are reported as failures and are never written.
Every call is written to the journal, successful ones included.
Request¶
{
"command": "MngUpdateLeadsAssignedManagerByFilter",
"extID": "1",
"data": {
"assigned_manager_id": 10,
"confirm": false,
"filter": {
"deskFilter": "*",
"limit": 100,
"offset": 0
}
}
}
Request Data¶
Top level:
| Field | Type | Required | Description |
|---|---|---|---|
assigned_manager_id |
int | Yes | Target CRM manager id, 0 or greater. 0 clears the assignment |
confirm |
bool | Yes | false reports what would change without writing. true applies the change |
filter |
object | Yes | Record selection |
filter object:
| Field | Type | Required | Description |
|---|---|---|---|
deskFilter |
string | Yes | Desk wildcard mask, for example *, DESK_*, DESK_EU*,!DESK_EU_TEST. Must not be empty |
limit |
int | Yes | From 1 to 50000. Validated, but it does not limit how much is processed |
offset |
int | Yes | Minimum 0. Validated, but it does not limit how much is processed |
where |
array | No | [[field, operator, value], ...], all conditions must match |
orWhere |
array | No | OR comparison group; at least one condition must match |
whereNot |
array | No | [[field, value], ...] |
whereIn |
array | No | [[field, [values...]], ...] |
whereNotIn |
array | No | [[field, [values...]], ...] |
whereBetween |
array | No | [[field, [from, to]], ...] |
whereNotBetween |
array | No | [[field, [from, to]], ...] |
orderBy |
array | No | Example: [["created_time", "desc"]] |
Filter fields and operators are the same as for the customer table, including the
lifecycle_flags operators has_all, has_any, and has_none. Common filter
semantics are described in Table filter syntax; desk masks in
Desks TCP API.
Manager Validation¶
The target manager is validated once, before the loop: one that does not
exist, is disabled, lacks CRM access, or is the hidden recovery manager
rejects the whole request with 400 INVALID_MANAGER rather than producing
one identical failure per record. The brand match is then checked per record,
and a mismatch fails that record with INVALID_MANAGER.
assigned_manager_id: 0 clears the assignment and skips both checks.
Response Data¶
Counters only, with no per-record rows, so the payload is the same size for four records or forty thousand.
{
"confirm": true,
"assigned_manager_id": 10,
"matched": 1240,
"updated": 900,
"skipped": 338,
"failed": 2,
"failures": [
{"customer_id": 1101, "error": "INVALID_MANAGER", "message": "Manager belongs to another brand"}
]
}
| Field | Type | Description |
|---|---|---|
confirm |
bool | Echo of the request flag |
matched |
int | Records selected by the filter, kind, brand scope, and desk mask |
updated |
int | Records actually written. Always 0 when confirm is false |
skipped |
int | Records that already held the requested value |
failed |
int | Records that did not pass the per-record checks |
failures |
array | One entry per failure with customer_id, error, and an optional message. Present only when non-empty |
Reading the Counters¶
After an applied run the identity matched = updated + skipped + failed holds.
On a dry run updated is 0 by definition, and the number of records that would
be written is matched - skipped - failed.
Response Statuses¶
| Status | Condition |
|---|---|
200 |
Dry run. Always, since nothing was meant to change |
200 |
Applied, at least one record written, no failures |
207 |
Applied, at least one record written, some failed |
409 |
Applied, nothing was written |
Once every record already holds the requested value, running the same request
again yields updated: 0 with skipped equal to matched and therefore 409.
That is an idempotent no-op, not a fault: tell the two apart by the counters.
Errors¶
| HTTP | Error | Description |
|---|---|---|
400 |
INVALID_DATA |
Request validation failed |
403 |
RET_NOT_ENOUGH_RIGHTS |
Missing permission, missing scope, or the record is outside the caller's visibility |
404 |
RET_NOT_FOUND |
No customer with that identifier exists |
Every error carries a message field with free-form text. Its contents are not
part of the contract; branch on error.