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
Marcio FritschMarcio Fritsch 

Modified rows exist in the records collection!

I am creating a component which uses ApexPages.StandardSetController implementation. I can only send a simple query, but I need to send a group by, and it does not work. I may have over than 2000 rows, in this case I cannot use OFFSET.
This component will not update nothing, just to list.
Is there any work around to avoid this message error?

Shashikant SharmaShashikant Sharma
This post having something similar may help you : https://developer.salesforce.com/forums/ForumsMain?id=906F000000095YxIAI

Answer in it is :

'Modified rows exist in the records collection'

This error means that the records collection in your VF controller's memory have been modified, not that the underlying records in the database have been modified between paging requests.

And, in fact, I was post-processing the Foo__c.name field in my controller to 'friendlify' it before showing to the user on the VF page.  Since the StandardSetController only works with pagination on a Database.getQueryLocator object, you can't use a List<customClass> to hold your friendlified field values.

So, the only alternative I came up with were additional Formula fields on Foo__c - which do the friendlification before the records are made available to the controller.


Marcio FritschMarcio Fritsch
What I could understand was to not use list<object> to StandardSetController, and yes using getQueryLocator method to do that? I already made this, and did not work. In my original post I mentioned I am using group by query and not a simple query such as : select id, name from object__c.
I am using :
select col1__c, sum(value__c)
from object__c
group by col1__c