I have built a customer portal using Force.com sites. All of the UI is custom built using VF pages with apex controllers. I am displaying some records using pagination with the standard set controller. I basically run a SOQL query, store the results in a list and bind that to a Apex:DataTable and display that data to the user.

Everything is fine except for when I leave a page showing the data for a while and then refresh it, it causes a visualforce error. The debug logs have been of no help. Its as if some kind of timeout or the data has "expired". Has anyone of you come across this error. How can I overcome this or resolve it gracefully instead of having the page crashing.

This is the way I am populating my list from the SOQL query results:

invoiceDetails = [SELECT idtl.Product__c, idtl.Quantity__c, idtl.Unit_Price__c, 
                         idtl.tax__c, idtl.Amount__c 
                         FROM Invoice_Detail__c idtl where idtl.Invoice__c=:invID
                         ORDER BY idtl.Product__c];
  • 1
    Can you tell me what is the error that you are getting ? – Priyanka Nov 29 '12 at 6:49
  • A Visualforce error. It is generic. I will try to add a screenshot the next time it happens. – Richard N Nov 29 '12 at 15:11

This is a known QueryLocator Bug-Feature:

The queryLocator value expires automatically after 15 minutes of inactivity.

Here is the official SF-Doc: QueryLocator

  • Thank you. Is there any known workaround or way to gracefully handle this? – Richard N Nov 29 '12 at 15:07
  • Also, I added the code snippet where I am populating my list. Is this method of using SOQL in Apex code also subject to the issue with the query locator? – Richard N Nov 29 '12 at 15:13
  • No, the pagination is the keyword here. You use the queryLocator in your pagination so after 15 min of inactivity it expires... – Sergej Utko Nov 29 '12 at 15:21
  • I think a possible workaround would be to add an actionPoller to the visualforce page, that polls some function every 5 minutes for example, so the page remains active. – Sergej Utko Nov 29 '12 at 15:25
  • I have not used Actionpollers but have not heard good things about them when used with a apex:DataTable.boards.developerforce.com/t5/Visualforce-Development/… – Richard N Nov 29 '12 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.