In Salesforce Enterprise Territory Management, deleting an AccountShare record with a RowCause of Territory2AssociationManual or Territory through Data Loader or the API returns the following error:
Insufficient Access Rights On Object Id. Status: INSUFFICIENT_ACCESS_OR_READONLY
This article explains why Salesforce returns an Insufficient Access error when you delete a territory-based AccountShare record, and how to remove the share by removing the territory assignment from the account.
This error is expected and by design. The system automatically creates and maintains these AccountShare records when a territory is assigned to the account. To remove an AccountShare established through Enterprise Territory Management, remove the territory that is assigned to the account. Salesforce then automatically deletes the corresponding AccountShare record.
If the AccountShare RowCause is "Territory", or the "Assigned Territories" related list on the account shows "Territory Assignment Rule" in the Method column, a territory assignment rule assigned the territory automatically. Deleting the related ObjectTerritory2Association record directly, or clicking the "Unassign" action in the related list, returns this message:
An Object Territory Association Cannot Be Created Or Deleted With Territory Assignment Rule Association Cause. Status: INVALID_OPERATION
Decide which of the following actions best fits your requirements. Then click the "Run Rules" button in the "Assignment Rules Defined in This Territory" related list on the territory detail page in Setup to re-evaluate the assignment rule and remove the accounts from the territory.
Use one of the following options to remove an account's manually assigned territory.
Run the following query to find the ObjectTerritory2Association records for an account. Replace AccountIdHere with the record Id of the account whose territories you want to remove.
SELECT Id, ObjectId FROM ObjectTerritory2Association WHERE ObjectId = 'AccountIdHere'
Use the returned ObjectTerritory2Association record Id, which has the key prefix 0JB, to perform a delete. This removes the manual territory assignment from the account. See Insert, Update, or Delete Data Using Data Loader for more details.
000380273

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.