I have a visual force page where I'm using an action method to mark a "timeStamp" of when the user opens the page for a given object.
Page:
apex:page standardController="myChart" extensions="chartExtension" action="{!markTime}"> ...
Extension code:
public void markTime() {
myChart__c c = [Select Id, myTimestamp__c From myChart__c Where Id = :chartVariable.Id];
if(c.myTimestamp__c == null) {
c.myTimestamp__c = DateTime.now();
update c;
}
This works well enough in that it updates the database correctly, but the field is still blank on the page. So far nothing I've tried has worked, is there a simple way to do this?