Loading
Ongoing maintenance for Salesforce HelpRead More
Feature degradation | Gmail Email delivery failureRead More

Export field history data with Data Loader

Publish Date: Oct 13, 2022
Description


Use the Data Loader export process to extract data older than 18 months from your field history. See Export Data for more information. 


Note: You can also retrieve this data using the method outlined in the SOAP API Developer Guide - queryAll()


Starting with Winter ’19, you can access data older than 18 months only in a limited fashion using Data Loader or via the API. Starting in Spring ’19, you can access field history data up to 24 months old, but we begin the process of removing field history data older than 24 months. See Retention Limit for Field History Data Is Now Enforced for details.

Resolution


To export object field history via Data Loader:

 
1. Open Data Loader.

2. Click Settings | Settings.

3. Uncheck Use Bulk API.

4. Click OK.

5. Click Export All.

6. Choose OAuth and enter your Salesforce username and password; or Choose 'Password Authentication' and enter your Salesforce username and password followed by your security token. Click on Log in. 

Note: If you selected OAuth earlier, you will receive a pop-up prompt. Click on 'Allow.'
 
7. When you’re logged in, click Next. You are not asked to log in again until you log out or close the program.

If your organization restricts IP addresses, logins from untrusted IPs are blocked until they’re activated. Salesforce automatically sends you an activation email that you can use to log in. The email contains a security token that you must add to the end of your password. For example, if your password is mypassword, and your security token is XXXXXXXXXX, you must enter mypasswordXXXXXXXXXX to log in.
 
8. Select 'Show all Salesforce objects.'

9. Choose the field history archive object you need, like the AccountHistory or ContactHistory object. The objects are listed by localized label name, with the developer name in parentheses. For object descriptions, see the SOAP API Developer Guide.

10. Click on Browse, enter a filename followed by a .csv and choose the location where you want the resulting file to be saved. Click on Save.

11. Click Next.

12. Create a SOQL query for the data export.

a. Choose the fields you want to export.
b. Optionally, select conditions to filter your dataset. If you do not select any conditions, all the data to which you have read access is returned.
c. Review the generated query and edit if necessary.

13. Click Finish.

A warning displays that says your export includes deleted records. Field history data deleted by Salesforce is not included.

14. Click Yes to confirm.

A progress information window reports the status of the operation. After the operation completes, a confirmation window summarizes your results.

15. To view the CSV file. click *View Extraction*, or to close, click OK.


Admins may also use a SOQL relationship query to include fields from a related object. For example:

Select Id, IsDeleted, AccountId, CreatedById, CreatedDate, Field, OldValue, NewValue, Account.Name FROM AccountHistory WHERE CreatedDate <= 2016-06-01T00:00:00.000Z

When using relationship queries in the Data Loader, the fully specified field names are case-sensitive. For example, use Account.Name instead of  ACCOUNT.NAME.

Data Loader doesn’t support nested queries or querying child objects. Queries similar to the following return an error: Error: Invalid soql: Nested queries are not supported

SELECT Id, Name, (Select Id, IsDeleted, AccountId, CreatedById, CreatedDate, Field, OldValue, NewValue, Account.Name FROM AccountHistory) FROM Account
 

See Also

Export Account History
Field History Tracking
 
Knowledge Article Number

000383373

 
Loading
Salesforce Help | Article