2

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'.

3 Answers 3

4

There is a field on OpportunityHistory called CreatedDate. Try that instead of LastModifiedDate.

3

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.

2
  • I believe that will still give me all the OpportunityHistory for the Opportunity that was updated. Is there a CreatedDate or something on OpportunityHistory? Mar 10, 2015 at 16:56
  • Yes, You can use createdDate of OpportunityHistory. In other word, the createdDate and lastmodifiedDate of OpportunityHistory will be always same. so use can definitely use createdDate.
    – Anup
    Mar 11, 2015 at 6:08
1

you can simply use CreatedDate instead of lastmodifieddate. as both will be same in case of OpportunityHistory object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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