When ever your requirement needs to process more than 50,000 records at a time, a trigger might not be your best bet. it's always safe to go with async processing like @future, batch etc
If you don't need an immediate processing, a batch + scheduled apex can do wonders.
Another work around is .... (not very advisable)
Create a VF page,
--> on click of the button --> Execute code --> then use javascript to click the button as many times you need to use the data... you'll be able to use the OFFSET parameter in SOQL.. this is a workaround only as a last resort... this helps you process things synchronously.. but the only disadvantage is that it needs a user to open the VF in a browser... ( might work for some use cases)
Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.
When ever your requirement needs to process more than 50,000 records at a time, a trigger might not be your best bet. it's always safe to go with async processing like @future, batch etc
If you don't need an immediate processing, a batch + scheduled apex can do wonders.
Another work around is .... (not very advisable)
Create a VF page,
--> on click of the button --> Execute code --> then use javascript to click the button as many times you need to use the data...
you'll be able to use the OFFSET parameter in SOQL.. this is a workaround only as a last resort... this helps you process things synchronously.. but the only disadvantage is that it needs a user to open the VF in a browser... ( might work for some use cases)
Please refer the below link for reference.
https://success.salesforce.com/answers?id=90630000000hNXkAAM
I hope it will be helpful.
Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.
Thanks
Rahul Kumar
CLASS
public class insert20{
public void m1()
{
list<ticket__c>ticket=new list<ticket__c>();
ticket__c objtest;
for(integer i=1;i<=20;i++)
{
objtest=new ticket__c(name='ticket'+string.valueof(i));
ticket.add(objtest);
}
insert ticket;
}
}
in anonymous block you write this code
insert20 obj=new insert20();
obj.m1();