1

In an Org I am trying to find the metadata of an object with api - Charts__History(Yes, with no __c). I could not find it in Salesforce Org UI so I used workbench to investigate.

I can run the query editor and I get a result. I am trying to add some value for this object as it has been used in a test class. Below is what I get from query editor:

enter image description here

From WorkBench:

enter image description here

enter image description here

enter image description here

What could be this metadata and what can I try to create a record related to this.

3

When you enable Field History Tracking for a Custom Object, a new object will be available to track these changes. This new object will have the same API Name as your custom object, except it will have the __history suffix instead of __c. You will need to change a tracked field and commit the update in order for such changes to show up in your database.

See also: What are the object and field name suffixes that Salesforce uses? Such as __c and __x

  • You might need to use SeeAllData for the tracked __history record to appear during your test. I'll have to double check. – Adrian Larson Nov 21 '17 at 19:19
  • 1
    Creating or modifying data in a test class or method with @seeAllData does not create field tracking history (just tried on cs14). See this question for a discussion on how to create field tracking records in test classes (hint: its a nightmare). – battery.cord Nov 21 '17 at 19:25
  • Well at least with that annotation you can query existing records without needing to create them yourself. – Adrian Larson Nov 21 '17 at 19:27
  • I create a record and changed the field that is been tracked. Used a query to retrieve __History but did not see any record returned. I tried with seeAllData as well. I might be missing something? – SfdcBat Nov 21 '17 at 19:33
  • As per my above comment, modifying records in a test context will not create a field tracking history record. You can vote on an idea to change this behavior here. If you have a specific use case where you need to cover some section of code which relies on existing field history records, I'd suggest asking a new question instead of trying to change the scope of an existing question. – battery.cord Nov 21 '17 at 19:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.