-2

Anyone knows the query how to track the history of a particular opportunity record , what changes made by the user by SOQL

1
  • 1
    Do you have field history tracking enabled on fields for the Opportunity object?
    – TSmith
    Commented Apr 8, 2020 at 11:17

1 Answer 1

2

You need to use relationship queries to relate the history with the record. Like:

SELECT OldValue, NewValue, Parent.Id, Parent.name, Parent.customfield__c
FROM foo__history

Please find here the official docs about this

3
  • i am using this query Select Id,Field, NewValue, OldValue,OpportunityId from OpportunityFieldHistory where OpportunityId = '0060k00000Asl4HAAR' and Field='Name' where i am enabling a custom field in opportunity with set track history but i am unable to query with that new custom field. Commented Apr 8, 2020 at 13:53
  • Also if i am using same query with only id then by default i am getting results for stage field but i want result based on custom field which i already enabled set track history setting Commented Apr 8, 2020 at 13:55
  • Do you get any error when you try to query that query field? I recommend you using workbench.developerforce.com to play around with queries easily. Commented Apr 9, 2020 at 8:58

Not the answer you're looking for? Browse other questions tagged .