To assign an Account record (or any app record) to a specific territory, follow these steps:
Create the Territory Field
-
Field Name:
Territory
-
Type: Reference field pointing to the Territories app.
-
Purpose: Stores the territory name.
-
In the Territories app, include a Regex field to handle the complex U.S. ZIP code patterns and map them to their corresponding U.S. state.
Set Up the Automation
Use an Assign Record automation on the Accounts app.
Trigger: After Create/Update on the Location.Zip Code
field.
Configuration:
-
Style: Select Territory.
-
Territory App: Choose the app containing the ZIP code Regex patterns.
-
Matching Rules:
-
Field:
Location.Zip Code
(from Accounts) -
Operator: Contains
-
From: Triggering Record
-
Value:
Location.Zip Code
(from Territories)
-
Note: These are two different fields—one in Accounts, one in Territories.
-
Rule Evaluation Order:
-
Sort By: ID
-
Direction: Ascending
-
Set Fields for the Assignment
Assign two fields in the automation:
-
Territories – Merge with the ID of the matching record from the
Territory
field in the Territories app. -
Name – Pull the territory name from the Territories app and display it in the
Territory
field in Accounts.
This setup ensures that when an account’s ZIP code matches a pattern in the Territories app, it is automatically assigned to the correct territory.