Zoho: Assign territories to multiple records
Zoho territories.assignTerritoriesToRecords: arguments, response, policy and SDK examples.
← Territories operations · Get started
Operation zoho.assignterritoriestorecords
Provider route: POST /crm/v8/{module}/actions/assign_territories. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/zoho with npm, or alter-sdk-zoho with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { ZohoIntegration } from "@alter-ai/zoho";
async function execute(input: Parameters<ZohoIntegration["territories"]["assignTerritoriesToRecords"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new ZohoIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.territories.assignTerritoriesToRecords(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_zoho import ZohoIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = ZohoIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.territories.assign_territories_to_records(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.module | string | Required within parent | The API name of the CRM module, of type string. use the [Get Modules API](modules.yaml#$.paths/settings/modules.get) to get the valid values. Maximum length: 100 |
body | object | Required within parent | Specify the records and territories to assign. Additional keys: not allowed |
body.data | array | Required within parent | Specify the list of records and their associated territories to assign. Maximum items: 10 Minimum items: 1 |
body.data[] | object | Each item | Specify the record ID and the list of territories to assign to that record. Additional keys: not allowed |
body.data[].Territories | array | Required within parent | Specify the list of territories to assign to the record. Each object in the array must contain the unique ID of the territory. Maximum items: 100 Minimum items: 1 |
body.data[].Territories[] | object | Each item | Specify a territory to assign to the record. Additional keys: not allowed |
body.data[].Territories[].id | string | Required within parent | Specify the unique ID of the territory to assign to the record. Format: int64 |
body.data[].id | string | Required within parent | Specify the unique ID of the record for which to assign the territories. Format: int64 |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | Model | Alternative | Expand Assign territories to multiple records — response body — data |
$ (anyOf 2) | JSON | Alternative | Represents the response returned when a territory assignment job has been scheduled. |
$ (anyOf 2) (anyOf 1) | Model | Alternative | Expand Assign territories to multiple records — response body — value data |
$ (anyOf 2) (anyOf 2) | Model | Alternative | Expand Assign territories to multiple records — response body — data |
Referenced models: Assign territories to multiple records — response body — value data, Assign territories to multiple records — response body — data
Schemas
Section titled “Schemas”Assign territories to multiple records — response body — value data
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents the response returned when a territory assignment job has been scheduled. Additional keys: not allowed |
data | array | Required within parent | Represents the list of record-territory association objects. Maximum items: 10 Minimum items: 1 |
data[] | Model | Each item | Expand Assign territories to a record — response body — value data data item |
Referenced models: Assign territories to a record — response body — value data data item
Assign territories to multiple records — response body — data
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents the response returned when territories are successfully assigned to records. Additional keys: not allowed |
data | array | Required within parent | Represents the list of territory assignment result objects. Maximum items: 10 Minimum items: 1 |
data[] | object | Each item | Represents the error details for a single territory assignment operation. Additional keys: not allowed |
data[].code | string | Required within parent | Represents the result code for the territory assignment. Possible values: **SUCCESS**. Known values: SUCCESS |
data[].details | object | Required within parent | Represents additional details about the territory assignment, including the record identifier. Additional keys: not allowed |
data[].details.id | string | Required within parent | Represents the unique identifier of the record to which territories were assigned. Format: int64 |
data[].message | string | Required within parent | Represents the success message returned for the territory assignment. Possible values: **the territories data updated successfully**. Known values: the territories data updated successfully |
data[].status | string | Required within parent | Represents the status of the territory assignment operation. Possible values: **success**. Known values: success |
Assign territories to a record — response body — value data data item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents the details of a single territory assignment operation. Additional keys: not allowed |
code | string | Required within parent | Represents the code for the scheduled territory assignment. Possible values: **SCHEDULED**. Known values: SCHEDULED |
details | object | Required within parent | Represents additional details about the scheduled territory assignment, including the record and job identifiers. Additional keys: not allowed |
details.id | string | Required within parent | Represents the unique identifier of the record. Format: int64 |
details.job_id | string | Required within parent | Represents the unique identifier of the scheduled job. Format: int64 |
message | string | Required within parent | Represents the message returned when the territory assignment is scheduled. Possible values: **Territory assignment process scheduled successfully**. Known values: Territory assignment process scheduled successfully |
status | string | Required within parent | Represents the status of the operation. Possible values: **success**. Known values: success |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: zoho.assignterritoriestorecords. Catalog operation: assignTerritoriesToRecords. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.