+ Start a Discussion
System Administrator 537System Administrator 537 

SOQL run on AccountHistory using Bulk API or Workbench - OldValue and NewValue disappear

Trying to query AccountHistory table using the bulk api or workbench. The OldValue and NewValue do not appear in the results, except when you put them at the beginning of the select clause.

1) SOQL where NewValue, OldValue disappear:

SELECT AccountId,CreatedById,CreatedDate,Field,Id,NewValue,OldValue FROM AccountHistory WHERE Field = 'Owner'

2) SOQL that results in duplicate rows, one with Id and other with Name for OldValue, NewValue, column headers are Unknown_Field__1 and Unknown_Field__2 instead of NewValue and OldValue:

SELECT NewValue,OldValue, AccountId,CreatedById,CreatedDate,Field,Id FROM AccountHistory WHERE Field = 'Owner'

The values do not disappear when using developer console, but I still get duplicate rows as mentiond above.
Prateek Singh SengarPrateek Singh Sengar
This is a known limitation of workbench, if you interested in executing the query you can try executing it in developer console. Developer console will be able to process your query correctly.

Hope it helps.