+ Start a Discussion
GenoudGenoud 

Enable History Tracking on Account Object while deploying a package with Metadata API

Hello everyone,

I'm trying to deploy a package which contains Custom fields added on Account standard object with History tracking enabled. The deployment fails with the error 
The entity: Account does not have history tracking enabled
I enabled the history tracking on the account object definition and it is not working. 
<enableHistory>true</enableHistory>
can someone help me understand what is going on?

Thanks 
Best Answer chosen by Genoud
SandhyaSandhya (Salesforce Developers) 
Hi,

There is a workaround suggested in below links.
a) Strip down Enable History Tags from Scratch org metadata and add them when deploying to sandboxes.
b) Enable History tracking manually before pushing the code to the scratch org.
I would suggest you refer below links for similar discussion.

https://salesforce.stackexchange.com/questions/188779/how-to-enable-account-history-tracking-in-scratch-org
 
https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F93A000000HTp1&fId=0D53A00003BauKc
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
 
Best Regards
Sandhya
 

 

All Answers

SandhyaSandhya (Salesforce Developers) 
Hi,

There is a workaround suggested in below links.
a) Strip down Enable History Tags from Scratch org metadata and add them when deploying to sandboxes.
b) Enable History tracking manually before pushing the code to the scratch org.
I would suggest you refer below links for similar discussion.

https://salesforce.stackexchange.com/questions/188779/how-to-enable-account-history-tracking-in-scratch-org
 
https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F93A000000HTp1&fId=0D53A00003BauKc
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
 
Best Regards
Sandhya
 

 
This was selected as the best answer
Shai FisherShai Fisher
You can enable history for objects by ant:
Strip anything from the object xml except enableHistory:
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <enableHistory>true</enableHistory>
</CustomObject>
(In some cases you need to add: <recordTypeTrackFeedHistory>true</recordTypeTrackFeedHistory>)

Then, deploy the original files, including tracking history fields.