Trying to push the source code to a scratch org I get the following error:

The entity: Opportunity does not have history tracking enabled (998:13)

But there is no option to specify on the scratch org definition file to enable the field history on opportunities. The only available option is to turn the history on for contracts.

Is there a workaround for this?

1 Answer 1


This issue is now properly addressed in Salesforce DX. You need to set enableAccountHistoryTracking to true, as outlined in the Scratch Org Settings documentation:

  "settings": {
   "accountSettings": {
     "enableAccountHistoryTracking": true

I've logged that bug with the DX team. The solution (for now) is to have an src directory in mdapi format, deploy the "history tracking" flag on the CustomObject first, and then deploy the fields afterwards.

sfdx force:mdapi:deploy -d src -w 10
sfdx force:source:push

Your src folder would be a traditional package:


<Package xmlns="http://soap.sforce.com/2006/04/metadata">


<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">

Most of the fields are not necessary for standard objects, but be aware you have to specify things like label, fullName, pluralLabel, sharingModel, etc for custom objects.

  • Hey, do you have, perhaps, an issue number or link for this bug? It is something I'd like too to keep track of. Commented Jun 29, 2018 at 20:01
  • 1
    @RenatoOliveira I spoke with Wade about it, he said he'd look in to it, but I don't have a number off the top of my head. It may be related to this issue, but the description doesn't match the current problem. I'll ask Wade if there was a Known Issue for this.
    – sfdcfox
    Commented Jun 29, 2018 at 20:05
  • 1
    @RenatoOliveira Oh, glad I could help, then. That was one of our showstoppers until I figured out this handy workaround (we since ran in to other issues, but at least I fixed this).
    – sfdcfox
    Commented Jun 29, 2018 at 20:19
  • 1
    @TemporaryFix Thanks, I've updated the answer to reflect this. I knew it, but as I have about 10k answers, it's hard to keep track of everything that needs updating.
    – sfdcfox
    Commented May 20, 2021 at 23:40
  • 1
    @sfdcfox the community appreciates all that you do! Commented May 20, 2021 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .