Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.recordstringRequired within parentThe 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.modulestringRequired within parentThe 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
bodyobjectRequired within parentSpecify the records and territories to assign in this request.
Additional keys: not allowed
body.dataarrayRequired within parentSpecify 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[]objectEach itemSpecify the record ID and the list of territories to assign to that record.
Additional keys: not allowed
body.data[].TerritoriesarrayRequired within parentSpecify 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[]objectEach itemSpecify a territory to assign to the record by providing its unique ID.
Additional keys: not allowed
body.data[].Territories[].idstringRequired within parentSpecify the unique ID of the territory to assign to the record.
Format: int64
body.data[].idstringOptionalSpecify 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 media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)ModelAlternativeExpand Assign territories to a record — response body — data
$ (anyOf 2)JSONAlternativeContains the scheduled or immediate success response for a territory assignment to a single record.
$ (anyOf 2) (anyOf 1)ModelAlternativeExpand Assign territories to a record — response body — value data
$ (anyOf 2) (anyOf 2)ModelAlternativeExpand 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

Assign territories to a record — response body — value data
FieldTypePresenceDescription and constraints
$objectRootRepresents the response returned when a single-record territory assignment job has been scheduled.
Additional keys: not allowed
dataarrayRequired within parentRepresents the list of record-territory association objects.
Maximum items: 1
Minimum items: 1
data[]ModelEach itemExpand 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
FieldTypePresenceDescription and constraints
$objectRootSuccessful response returned when territories are assigned to a record.
Additional keys: not allowed
dataarrayRequired within parentArray containing the result of the territory assignment.
Maximum items: 1
Minimum items: 1
data[]objectEach itemDetails of the territory assignment operation.
Additional keys: not allowed
data[].codestringRequired within parentStatus code indicating the territory assignment was successful.
Known values: SUCCESS
data[].detailsobjectRequired within parentAdditional information about the territory assignment.
Additional keys: not allowed
data[].details.idstringRequired within parentUnique identifier of the record.
Format: int64
data[].messagestringRequired within parentSuccess message confirming that the territory data was updated.
Known values: the territories data updated successfully, the territories data removed successfully
data[].statusstringRequired within parentIndicates whether the operation succeeded or failed.
Known values: success
Assign territories to a record — response body — value data data item
FieldTypePresenceDescription and constraints
$objectRootRepresents the details of a single territory assignment operation.
Additional keys: not allowed
codestringRequired within parentRepresents the code for the scheduled territory assignment. Possible values: **SCHEDULED**.
Known values: SCHEDULED
detailsobjectRequired within parentRepresents additional details about the scheduled territory assignment, including the record and job identifiers.
Additional keys: not allowed
details.idstringRequired within parentRepresents the unique identifier of the record.
Format: int64
details.job_idstringRequired within parentRepresents the unique identifier of the scheduled job.
Format: int64
messagestringRequired within parentRepresents the message returned when the territory assignment is scheduled. Possible values: **Territory assignment process scheduled successfully**.
Known values: Territory assignment process scheduled successfully
statusstringRequired within parentRepresents the status of the operation. Possible values: **success**.
Known values: success

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.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.