Is there a way to mass remove manually assigned Accounts in a Territory Model ?
Note, currently there no assignment rules in the Territory model. This is a sandbox.
ObjectTerritory2Association has this information and a field called AssociationCause
The means by which the record was associated with the territory. User interface field label is Method. Possible values are:
- Territory2AssignmentRule—Territory assignment rule association
- Territory2Manual—Manual association
As such, you should be able to just do the following in anonymous apex (or just query to use dataloader):
List<ObjectTerritory2Association> manualTerritoryAssignments = [
SELECT Id
FROM ObjectTerritory2Association
WHERE AssociationCause = 'Territory2Manual` AND SobjectType = 'Account'
];
delete manualTerritoryAssignments;
You can also filter by the Territory2
if you just want to remove certain territory assignments.