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
Kamran-RaoKamran-Rao 

PageBlock not Refreshed When 'Field' is Included in the Custom List of History Tracking

I am working on History Tracking for one of my custom object and want it to be displayed in a customized fashion. I made two page blocks; 1st page block displays the items in grid with a link in first column as History (rerendered the 2nd page block on its click). In 2nd page block I created a Apex:pageBlockTable to display CreatedBy, CreatedDate, Field, OldValue, NewValue. This 2nd page block displays the History respective to the item clicked in the 1st page block.

 

Problem:

Everything works as supposed only when I exclude the Field column. If I put the field column in my 2nd page block, pageblock is not refreshed and nothing is displayed.

<apex:form id="pixelReqForm"> <apex:pageBlock title="Pixel Request Form (PRF)" id="PixReqForm"><br></br> <apex:pageBlockTable value="{!PixelReq}" var="aPixelReq" id="pixelReqTable"> <apex:column headerValue="History" id="hisTrack"> <apex:commandLink value="History" reRender="pixelReqHisTable"> <apex:param name="pixelReqID" value="{!aPixelReq.id}"/> </apex:commandLink> </apex:column> <apex:column headerValue="Delete" id="isDeleteColumn"> <apex:inputCheckbox value="{!aPixelReq.isDeleted__c}" id="isDelete"/> </apex:column> <apex:column headerValue="Agency"> <apex:inputField value="{!aPixelReq.Agency__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlock title="Pixel Request Form (PRF)" id="pixelReqHistBlock"><br></br> <apex:pageBlockTable value="{!PixReqHistory}" var="aHistory" id="pixelReqHisTable"> <apex:column headerValue="Created By" id="createdBy"> <apex:outputField value="{!aHistory.CreatedById}"/> </apex:column> <apex:column headerValue="Changed Field" id="changedField"> <apex:outputField value="{!aHistory.FIELD}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlock title="PRF History Tracking" id="histIFrame"> </apex:form> </apex:page> =============================== Controller: ... List <PixelReqForm__History> pixReqHist; public List<PixelReqForm__History> getPixReqHistory() { pixReqHist = [Select Id, IsDeleted, ParentId, CreatedById, CreatedDate, Field, OldValue, NewValue FROM PixelReqForm__History where PARENTID = :ApexPages.currentPage().getParameters().get('pixelReqID') order by createdDate desc]; return pixReqHist; } ...

 

 

Regards,
Rao

Best Answer chosen by Admin (Salesforce Developers) 
sforce2009sforce2009
Put the pageblock in an output panel and try with apex:outputText instead of outputFiled

All Answers

sforce2009sforce2009
Put the pageblock in an output panel and try with apex:outputText instead of outputFiled
This was selected as the best answer
Kamran-RaoKamran-Rao

You have saved my life. Thank you for your help. This is the solution.

 

Regards,
Rao