+ Start a Discussion
tzuvytzuvy 

Querring for account history

Hi,

 

I'm creating a VF page in which I want to display the list of Account History changes for a specific account.

I'm querring for the account this way in a controller:

 

account = [select field1, field2, field3  from Account where field4= :params.get(0)];

 

And presenting them in a page block section this way:

 

<apex:pageblockSection id="Account" columns="1"
                title="account" collapsible="true">
                <apex:pageblocktable align="center" value="{!account}" var="account"
                    title="account" width="100%">
                    <apex:column headerValue="Field1" width="10%">
                        <apex:outputField value {!account.Field1}></apex:outputlink>
                    </apex:column>
                       <apex:column headerValue="Field2" width="10%">
                        <apex:outputField value {!account.Field2}></apex:outputlink>
                    </apex:column>

   <apex:column headerValue="Field3" width="10%">
                        <apex:outputField value {!account.Field3}></apex:outputlink>
                    </apex:column>


                    </apex:pageblockTable>
            </apex:pageblockSection>

 

How can I querry and present the same way the account history for this account?

 

Thanks

 

Tzuvy

vanessenvanessen

have you tried this select:

 

accountHistoryList = [Select a.OldValue, a.NewValue, a.Field, a.AccountId From AccountHistory a where Field = 'xxxx' and AccountId = accId];

 

where accId is the id of an account.

 

just try and see.