In Salesforce, territory management is crucial for the Sales operation of the organization. With territory models, we can efficiently organize the opportunity records. If you enable ‘Enterprise Territory Management’ in your organization, the ‘Territory’ field will become available in the ‘Opportunity’ object.
We can update the territory field for an opportunity object with the help of a data loader, especially if it was not automatically updated after running the territory assignment rule.
In this Salesforce tutorial, we will learn how to mass update territories on opportunity records via the data loader in Salesforce.
Update Territory on Opportunity records via Data Loader in Salesforce
To Update Territory on Opportunity records via Data Loader in Salesforce, ensure you have enabled Enterprise Territory Management and defined territory models and types.
1. We must prepare a CSV file with the following header column to update territories on opportunity records.
- OpportunityId: Id of the opportunities in which you have to update territories
- Territory2Id: Id of the territory available in your org.
2. To get the opportunity ID, run a data export for the Opportunity object by following the steps.
- Open the data loader and click Export.
- Select the data object Opportunity and click Next.
- Select the query field ID and select the Name field for reference.
- Click Finish.
3. To get the Territory2Id, again perform an export operation for the territory object by following the steps.
- Open the data loader and click Export.
- Click on the Show All Salesforce object, select the Teritory2 object, and click Next.
- Select the query field ID and select the Name field for reference.
- Click Finish.
We can also get the territory ID from the ‘Territory Model‘ in Setup, then click on ‘View Hierarchy‘ and finally click on the territory. The Territory ID can be viewed on the URL and would start with ‘0MI’.
4. Now, in the CSV file with the columns Opportunity Name, Territory ID, and Opportunity ID, enter the IDs of the territories adjacent to the opportunity IDs and save the CSV file in your system from where it can be accessed to the data loader.

5. Open the data loader and click on the Update button.

6. In this step, select the data object Opportunity and browse the CSV file we created in the above steps. After this, click on the Next button.

7. Now, the data loader will initialize the uploaded CSV file. Here, click on the OK button to proceed.

8. In this step, we will map the column header with the object field names, and for that, click on the Create or Edit a Map; then, in the Mapping Dialog window, click on Auto-Match Fields to Columns.
If the field names are not auto-matched, you must drag the fields down to the column mapping.
After mapping, click on the OK button, then click on Next.

9. Select the location for the success and error file from where it can be accessed later. At last, click on the Finish button.

10. A warning message will appear regarding the data update operation as we click the Finish button. Here, click on the Yes button to proceed.

11. Now, the data loader will start the data update operation. After the completion of the data operation, a dialog box will display the number of successes and errors that occurred during the data update.
In this example, we got the success message with zero errors, which means we successfully updated the territory in the Opportunity records.
Here, click on the OK button to close the data loader.

12. To view the updated data, go to the opportunity record in which you have updated the territory, and in the territory field, you can view the updated territory.

This way, we can mass update Territory on Opportunity records via Data Loader in Salesforce by following the above steps.
Conclusion
In Salesforce CRM, efficient territory management is important for the organization’s sales process, and the Salesforce data loader proves to be a useful tool in the mass management of territory data for Salesforce objects.
Following the above steps, you might have understood the process of Mass updating Territory on Opportunity records via data loader. By now, you can manage and update the territory for opportunity records in your Salesforce environment.
Do you like to read:
- Manage Territories and Territory Models for Opportunities in Salesforce
- How to Clone Opportunity in Salesforce
- Display Account Fields on an Opportunity Record Page in Salesforce
- How to Add Values to Opportunity Stage Picklist in Salesforce
- Add or remove Opportunity Team members with Data Loader in Salesforce
- Mass Data Operations Using Salesforce Workbench
- How to Mass Delete Opportunities in Salesforce using Data Loader
- How to Update Parent Record From Child Object using Salesforce Flow
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.