+ Start a Discussion

How to show opportunity field history on VF page?



I am using <apex:detail relatedList="false"/> in my VF page.


so i am not able to show a history of opportunity..


I just want to show opportunity history


How can i show that?


i do not know the relationship between the Opportunity and opportunity field history object.



<apex:relatedlist subject="{!Opportunity}" list"___________">


i do not know what to write there?



Any kind of help wiil be greatly appriciated.





Vishal Thoriya.


There is an object that saves Opportunity field history... Try this below SOQL on Opportunity that has a sub query on Opp. field history....


Select (Select Id, IsDeleted, OpportunityId, CreatedById, CreatedDate, Field, OldValue, NewValue From Histories) From Opportunity o

/// Or 

Select o.OpportunityId, o.OldValue, o.NewValue, o.IsDeleted, o.Id, o.Field, o.CreatedDate, o.CreatedById From OpportunityFieldHistory o

Now, use this SOQL and pageBlockTable along with your standard controller to show this grid....