Zoho: Assign territories to a record
Zoho territories.assignTerritoriesToRecord: arguments, response, policy and SDK examples.
← Territories operations · Get started
Operation zoho.assignterritoriestorecord
Provider route: POST /crm/v8/{module}/{record}/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"]["assignTerritoriesToRecord"]>[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.assignTerritoriesToRecord(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_record(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.record | string | Required within parent | The unique ID of the record, of type string. Use the [Get Records API](record.yaml#$.paths./{module}.get) to get the valid values. Format: int64 |
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 in this request. Additional keys: not allowed |
body.data | array | Required within parent | Specify the list of records and their associated territories to assign. Each object must include a record ID and a Territories array. Maximum items: 1 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. Use the Get Territories API to retrieve the available territory IDs. Maximum items: 100 Minimum items: 1 |
body.data[].Territories[] | object | Each item | Specify a territory to assign to the record by providing its unique ID. 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 | Optional | Specify the unique ID of the record for which to assign the territories. This field is optional when the record ID is specified in the request URL. 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 a record — response body — data |
$ (anyOf 2) | JSON | Alternative | Contains the scheduled or immediate success response for a territory assignment to a single record. |
$ (anyOf 2) (anyOf 1) | Model | Alternative | Expand Assign territories to a record — response body — value data |
$ (anyOf 2) (anyOf 2) | Model | Alternative | Expand Assign territories to a record — response body — data |
Referenced models: Assign territories to a record — response body — value data, Assign territories to a record — response body — data
Schemas
Section titled “Schemas”Assign territories to a record — response body — value data
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents the response returned when a single-record 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: 1 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 a record — response body — data
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Successful response returned when territories are assigned to a record. Additional keys: not allowed |
data | array | Required within parent | Array containing the result of the territory assignment. Maximum items: 1 Minimum items: 1 |
data[] | object | Each item | Details of the territory assignment operation. Additional keys: not allowed |
data[].code | string | Required within parent | Status code indicating the territory assignment was successful. Known values: SUCCESS |
data[].details | object | Required within parent | Additional information about the territory assignment. Additional keys: not allowed |
data[].details.id | string | Required within parent | Unique identifier of the record. Format: int64 |
data[].message | string | Required within parent | Success message confirming that the territory data was updated. Known values: the territories data updated successfully, the territories data removed successfully |
data[].status | string | Required within parent | Indicates whether the operation succeeded or failed. 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.assignterritoriestorecord. Catalog operation: assignTerritoriesToRecord. 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.