Loading

Run territory assignment rules when you edit an Account

Date de publication: Oct 13, 2022
Description

The administrator of an org with Enterprise Territory Management enabled wants territory assignment rules to run when Accounts are edited.

See also:
Use Rules to Assign Accounts to Territories
 

Résolution

There is a checkbox that can be added to the Account page layout called "Evaluate this account against territory rules on save". 

To add this checkbox to the page layout, perform the following steps:


1. Setup -> Customize -> Accounts -> Page Layouts

2. Click Edit next to the page layout

3. Click the Layout Properties button at the top of the page

4. Check the "Show on edit page" checkbox next to "Evaluate this account against territory rules on save"

5. Optionally check the "Select by default" checkbox to auto-check the checkbox on the page layout

6. Click OK then save the page layout

Note:  Make sure Territory Model is Activated prior to changing the Territory Number(if Custom Territory Number field was used) for the Account Territory record to be available in Assigned Territories Related List.

The user can uncheck the “Evaluate this account against territory rules on save” checkbox on the edit page, and territory assignment rules will not be run.

As of version 21 of the Force.com Apex Code Developer's Guide, there is not a way to run territory assignment rules through Apex: "assignmentRuleHeader method - The database.DMLOptions object supports assignment rules for cases and leads, but not for accounts or territory management."

The only option as of API version 21 is to use the Web Services API. See AssignmentRuleHeader in the Web Services API Developer Guide for more information:

"AssignmentRuleHeader – useDefaultRule - If true for a Case or Lead, uses the default (active) assignment rule for a Case or Lead. If specified, do not specify an assignmentRuleId. If true for an Account, all territory assignment rules are applied, and if false, no territory assignment rules are applied."

Note: If a territory has multiple locally-defined account assignment rules, an account is assigned to the territory only if it matches all locally-defined account assignment rules on the territory.

Related Ideas
Programmatic access to territory management / assignment rules

Numéro d’article de la base de connaissances

000385116

 
Chargement
Salesforce Help | Article