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
SS KarthickSS Karthick 

Display list of ids

Hi folks,
           Can anyone tell me how to display the list of id values???
My apex class is:
public class ListIdValues{
    public static List<Id> IdValues(){
        list<Id> a=new list<Id>();
        a.add('00E90000000eytMEH1');
        a.add('00E90000000eytMEH1');
        a.add('00E90000000eytMEH1');
        a.add('00E90000000eytMEH1');
        a.add('00E90000000eytMEH1');
        return a;
    }
}
I tried like
List<id> lis=ListIdValues.IdValues();
for(Integer j=0;j<lis.size();j++)
    System.debug('list values='+ lis[j]);

how to display all the values in anonymous window??


Best Answer chosen by SS Karthick
Shyam BhundiaShyam Bhundia
try
for(ID aID : a){
  	system.debug(aID);
  }


All Answers

Shyam BhundiaShyam Bhundia
try
for(ID aID : a){
  	system.debug(aID);
  }


This was selected as the best answer
Shyam BhundiaShyam Bhundia
try this:

for(ID aID : ListIdValues.IdValues()){
  	system.debug(aID);
  }


Ranjeet Singh (SFDC Developer)Ranjeet Singh (SFDC Developer)
Hi Karthick Saravanan ,
===============================================================================================
1. Create new class and Save following code:

public class ListIdValues{
    public static List<Id> IdValues(){
        list<Id> a=new list<Id>();
        a.add('00E90000000eytMEH1');
        a.add('00E90000000eytMEH1');
        a.add('00E90000000eytMEH1');
        a.add('00E90000000eytMEH1');
        a.add('00E90000000eytMEH1');
        return a;
    }
}

2. Open Developer Console:
 Go to Your Name => Developer Console

3. Go to Debug Menu & Select Open Execute Anonymous Window
                               OR
   Press: CTRL+E

Small winow will open after completion of step 3

4. Paste following code:

List<id> lis=ListIdValues.IdValues();
for(Integer j=0;j<lis.size();j++)
    System.debug('list values='+ lis[j]);

5. Press Execute Button, that available below in the execute anonymous window.
===============================================================================================                                
I hope, code should execute successfully.
Please let me know if you find any issue.


Thanks & Regards,
Ranjeet Singh.
Ranjeet Singh (SFDC Developer)Ranjeet Singh (SFDC Developer)
To See the Result:
1. Create a Debug Log for User
2. See in the Developer Console:
in Developer Console:
1. Go to Logs tab, that available below in the Developer Console.
2. Double Click on generated log.
3. in the log filter, Select Debug Only
You can finally see the result.