+ Start a Discussion
VFVF 

To store a list with more than 5000 records

Hello, 

Can we add a total of nearly 5000 ids to a particular list of string type.If there is any method or soln please help me out.

Thanks

shaan 

jhenningjhenning

shaan,

You can have a list of lists. Here is a code snippet that is a list that contains five lists. Each of the five lists contains 1000 items:

 

List<List<Integer>> outsideList = new List<List<Integer>>(); for (integer i=1; i<=5; i++) { List<Integer> insideList = new List<Integer>(); for (integer s=1; s<=1000; s++) { insideList.add(s); } outsideList.add(insideList); }

 

VFVF

Thanks for Your reply John,

I went through  your code, In your code you are using  list of lists with this we can add no: of lists to a particular list.

 

 But my problem here is that i am using an api call which executes records upto a max limit of 5000 records .

 

The api call is

Integer segmentId  = createImmediateSegment('U/N', 'P/W','Version', List<String> emails);

 

Here in the above call i can pass List<string> as parameter but not List<List<string>>.

 

The exception raised when List<List<string>> is passed.

  

 

 

jhenningjhenning
In that case, I think you will need to make multiple calls to the API sending 1000 records per call.
VFVF
Thanks for the reply John i did the same...If there is any solution for the issue please let me know.