I'm having issues defining a scratch org that matches our production org.

In our production and sandbox instances, we have implemented Salesforce's Field Audit Trail product. This allows us to have up to 60 fields auditable with a retention process of 10 years.

Although, when defining the project-scratch-def.json with the feature AddHistoryFieldsPerEntity:25, the is a limit of 25 fields being audited.

  • Has anyone else encountered this problem?
  • Is there another way to have this product enabled as a feature in the project-scratch-def.json?
  • Would a workaround be to manually go through the source for the project and switch the trackable variable on the fields?

any help would be appreciated :)

1 Answer 1


I just found your question while looking up how to enable Field Audit Trail for my scratch org so that I could create a History Retention Policy.

In my search, I did find that you can add the feature "RetainFieldHistory" to your scratch org definition features:

"features": [

and that seems to enable Field Audit Trail. I was able to create a History Retention Policy after that, and I tracked 38 fields on Account, which shouldn't be possible without Field Audit Trail (a limit of 20 I believe).

EDIT: As of Spring '20, Salesforce has rightly updated the title of this feature to FieldAuditTrail. RetainFieldHistory will no longer work for enabling Field Audit Trail in your scratch org.

You must log in to answer this question.

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