function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Varun99Varun99 

field tracking in vf page

Hi,

 

 

How to query on field history object in vf page? i have an object Product_table__c enabled for field tracking for one field

and am getting record id how to know history object API name?

 

Any one help me

 

 

Thank you

Best Answer chosen by Admin (Salesforce Developers) 
Bhawani SharmaBhawani Sharma
You will have to query Product_table__history object. Like
Select OldValue, NewValue, FieldName from Product_table__History where ParentId =: Id and FieldName = fieldAPIName

All Answers

Bhawani SharmaBhawani Sharma
You will have to query Product_table__history object. Like
Select OldValue, NewValue, FieldName from Product_table__History where ParentId =: Id and FieldName = fieldAPIName
This was selected as the best answer
Varun99Varun99

Hi,

 

 

Thank you for your reply. Exactly what am i expect it is correct solution. But am  facing one more problem Shall i pagination on history records am using standard set controller am getting this visualforce error

 

"List controllers are not supported for Product_Table__History"

 

my standard set controller

 

 

public ApexPages.StandardSetController fiopagnation
{
get {
if(fiopagnation== null) {
fiopagnation= new ApexPages.StandardSetController(Database.getQueryLocator([Select ID,createddate,parentid,CreatedById,CreatedBy.Name,Field, OldValue, NewValue from Product_Table__History where parentid=:productid ORDER BY CreatedDate DESC]));
// sets the number of records in each page set
fiopagnation.setPageSize(20);
}
return fiopagnation;
}
set;
}
public list<Product_Table__History> categories=new list<Product_Table__History>();
public List<Product_Table__History> getCategories()
{
categories = new List<Product_Table__History>();
for (Product_Table__History category : (List<Product_Table__History>)fiopagnation.getRecords())
categories.add(category);
return categories;
}

 

Is it possible to set pagination for history object adding wraper class?

 

Thank you

subbu123.pbt@gmail.comsubbu123.pbt@gmail.com
what are the tools we are using to tracking the code in Apex,, visualforce ?
Varun99Varun99

Hi subbu,

 

        Thanks for your reply. Am enabled field history track for my cost field and get in my visual force page through apex soql.

Rabbani sayyed 8Rabbani sayyed 8
Hi sharma
can we query in visualforce page ? is this best practise?