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
Sowjanya Hegde 13Sowjanya Hegde 13 

Platform event for bulk DML Insert

I have writen a APEX code(REST Integration) to get the http response from the endpoint which has more than 10,000 rows. This response i need to insert as a record in Salesforce. I have created the list for these records to insert which has more than 10,000 rows. SInce There is a limitation in APEX, I cannot perform DML operation for this list. How can I fix this problem using Platform event. Please help me with the detailed steps.

Thank you!
AbhishekAbhishek (Salesforce Developers) 
The simplest solution would be to insert 5000 in one pass, and then use the Test.Starttest(), which will give you a fresh set of limits.

Using a batch won't solve the problem directly in a test class, but you could use a batch outside of a the test method. Then, run the test with "seeAllData= true". Its not ideal, but that approach could give you many thousands of records to test with.


For further suggestions, you can check below,

https://developer.salesforce.com/forums/?id=906F0000000AdBnIAK

https://developer.salesforce.com/forums/?id=906F0000000AdBnIAK


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.