Want to write an soql query on Accounts and products. If i select Account lookup in visualforce page i want to display history information of that account in table format. I tried to write an soql query where i am unable to get output please some one help me out.
1 Answer
On Account, if you use Setup -> Customize -> Accounts -> Fields -> Set History tracking you can nominate fields for which changes are recorded and query that data like this:
public AccountHistory[] history {
get {
return [
select OldValue, NewValue, IsDeleted, Field,
CreatedDate, CreatedById, CreatedBy.Name
from AccountHistory
where AccountId = :accountId
order by CreatedDate desc
];
}
}
But unfortunately this history tracking mechanism is not available for products.