What will happen if you set readonly mode for entire VF page ?

A long back, My client reported an issue that he is unable to see attachments section on service console as well he was getting an Exception so called ‘Collection size 1,009 exceeds maximum size of 1,000.’

Because our <apex:dataTable>,<apex:dataList>, and <apex:repeat> VF tags has a limitation that they can iterate over only 1000 records, if it is more than 1000 records during 1001 iteration they will run into collection size limit exceeded error.

Now I need to handle that exception, for that i set the readOnly attribute on the <apex:page>component to true, So  In read-only mode, this limit is relaxed to allow querying up to 1 million rows. Now problem solved, Client was able to see attachments section!

Technical Explanation of ‘readonly = true’ VF tag :-

To enable read-only mode for an entire page, set the readOnly attribute on the <apex:page>component to true.

Normally, queries for a single Visualforce page request may not retrieve more than 50,000 rows. In read-only mode, this limit is relaxed to allow querying up to 1 million rows.

In addition to querying many more rows, the readOnly attribute also increases the maximum number of items in a collection that can be iterated over using components such as <apex:dataTable>,<apex:dataList>, and <apex:repeat>. This limit increased from 1,000 items to 10,000.

 

Thanks,

Dineshkumar Rajamani

Be the first to comment

Leave a Reply

Your email address will not be published.


*