This query:
select ID, StageName, Probability, Amount, CloseDate from OpportunityHistory where OpportunityId = 123 and LastModifiedDate > 2015-01-01T00:00:01z
Throws this error:
No such column 'LastModifiedDate' on entity 'OpportunityHistory'.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityThere is a field on OpportunityHistory called CreatedDate. Try that instead of LastModifiedDate.
OpportunityHistory object represents the history of a change to the Amount, Probability, Stage, or Close Date fields of an Opportunity. This object is read-only. The system generates a new record whenever a user or client application changes the value of any of the above fields. As this is read only object and will not be updated anymore, LastmodifiedDate field is not available for this object. Instead you can add a clause for LastmodifiedDate of opportunity. Like - select ID, StageName, Probability, Amount, CloseDate from OpportunityHistory where OpportunityId = 123 and Opportunity.LastModifiedDate > 2015-01-01T00:00:01z
OR You may use createdDate of OpportunityHistory. As OpportunityHistory are read only and wont be updated anymore, the createdDate and lastmodifiedDate of OpportunityHistory will be always same. so you can definitely use createdDate.
you can simply use CreatedDate instead of lastmodifieddate. as both will be same in case of OpportunityHistory object.