2

I have a custom object and I have enabled the checkbox Tract Field History my question is, how can you show your tracking field histroy in Visualforce Page?

I need a way to show the customer what has been changed Username, DateTime etc...

I just need a way to know what is involved in order to display this data.

3
  • Why do you think you need a Visualforce Page? You can just use the OOB Related List in your Page Layout.
    – Adrian Larson
    Commented Jan 6, 2017 at 18:03
  • what is OOB ? well... I haven't done this before so I'm not sure, what approach to take.
    – Nick
    Commented Jan 6, 2017 at 18:04
  • Out Of Box. It comes pre-built. Are you just trying to add them to the Page Layout?
    – Adrian Larson
    Commented Jan 6, 2017 at 18:05

2 Answers 2

6

You don't need Visualforce at all to display them in the Page Layout. You can look at the Related Lists for your object, search Hist... and you should see something like Account History.

If you're trying to add it to an existing Visualforce Page instead of a Page Layout, simply use the <apex:relatedList> tag:

<apex:page standardController="Account">
    <apex:relatedList list="Histories" />
</apex:page>
2
  • As I'm exploring the more options, I'm looking at the apex:component and in order to use the component I can not use standardController, in this case how would you use apex:relatedList list= Histories? any guidance?
    – Nick
    Commented Jan 6, 2017 at 19:46
  • @NickKahn Honestly, that's kind of a different question, and you might want to provide a bit more detail when you ask it.
    – Adrian Larson
    Commented Jan 9, 2017 at 13:51
1

@Nick Kahn, If you intend to use an apex:component, then you might have to query AccountHistory object that you could use in the component.

AccountHistory Query example:

SELECT AccountId, Account.Name, CreatedBy.Name, CreatedDate, Field, OldValue, NewValue 
FROM AccountHistory
1
  • Why downvote any explanation?
    – Nick
    Commented Jan 9, 2017 at 18:53

You must log in to answer this question.

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