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
tommytxtommytx 

How to display my found records using Debug.

Getting my list seems to work fine, but can someone give me a pointer in the right direction to display my new found data by scanning thru the list and printing each one after the other using the debug command.

 

 

List<Lead> aa = [SELECT Id, lastName, firstName FROM Lead WHERE Ownerid = 'ZZZZYYYYYYYxxxx'];

 

// From this list, you can access individual elements:

if (!aa.isEmpty()) {
   // Execute commands

system.debug('First Name Last Name ========>' + lastName + firstName);

}

Best Answer chosen by Admin (Salesforce Developers) 
Jeff MayJeff May

for (Lead l : aa) {

  system.debug('This is a lead: ' + l.LastName);

}

All Answers

Jeff MayJeff May

for (Lead l : aa) {

  system.debug('This is a lead: ' + l.LastName);

}

This was selected as the best answer
tommytxtommytx
Thank you Jeff that worked fantastic... At first it failed then when I looked around i realized that I was still using that phony Ownerid and when I put in a real id all is well....
Back to the drawing board, I am spending 24x7 in learning mode and building tons of Email2Lead stuff.... I am compiling every bit of data i can find... if you know of any great tutorials on the subject let me know... I am an old php mysql guy so this Apex is kicking my but .... but slowly and surely I am getting the hang of it..
Jeff MayJeff May
I know the feeling. There is definitely a learning curve, especially from other platforms/languages. That's why these boards are so active. We can all share what we know so when we get stuck someone else can bail us out.