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

Is there a limit to the number of records I can send to my VF page?


I am creating a large PDF document from my Apex controller.  From the controller , I am sending over 400 record IDs.

So, the URL that is returned from the controller looks like this:

apex/myPage?id=a16V00000GVC4IAO%2C..... plus 400 or so more IDs.


When I run the code with fewer IDs, it works.

When I run with over 400 IDs, I get a Heap error.

I can't view any more info about the error, because the Developer Console crashes every time.


Is there a limit to how many IDs I can send to a page using the method above?

Any help would be greatly appreciated!

Thank you in advance!

Best Answer chosen by Admin (Salesforce Developers) 



The URL size is different for different browsers. Refer below URL for URL size:


However, the reason for your code fail is not URL rather you are trying to compute which goes beyond allocated heap memory in Salesforce.


Try to minimize the variable declarations or limit the number of records.

Refer this article which explains in detail about Heap memory: