You need to sign in to do that
Don't have an account?
Arek Stegienko Dev
What's the best way to query Lead History objects
I need to get a list of lead history objects between two dates. I've come up with this approach:
[SELECT (SELECT LeadId, CreatedDate, Field, OldValue, NewValue FROM Histories WHERE CreatedDate >= :fromDate AND CreatedDate <= :toDate) FROM Lead]
however, that returns a list of all leads that I then would have to go through and check if they actually contain any history. Is there a way to directly access the lead history object and query that table?
Thanks,
Harry
Hi
Try this..
[SELECT (SELECT LeadId, CreatedDate, Field, OldValue, NewValue FROM LeadHistories WHERE CreatedDate >= :fromDate AND CreatedDate <= :toDate) FROM Lead]
Did this post solve your problem If so please mark it solved so that others benifited.
Thanks
asish
can i create trigger on leadHistory object?
Hi
I think we cant create Trigger on LeadHistory Object .
Generally We can create Trigger on a object on which we can be able to insert, update , delete record so that Trigger can be fired.
Thanks
asish
For the original question, in Apex code, the query to get all changes between two dates inclusive would be