+ Start a Discussion
Vishal_ThoriyaVishal_Thoriya 

How to show opportunity field history on VF page?

Hi,

 

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.

 

 

Thanks,

 

Vishal Thoriya.

bvramkumarbvramkumar

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