Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. QA Testing
  3. Question
QA Testing

Creating a list in Apex

Asked by Angela Baker Aug 3, 2021 504 views 1 answer
Share

About this question

 I have made this list and it's supposed to return all the users that are active but I don't know why the for loop is wrong. Do I need a Set?

public with sharing class ActiveAgents { public ActiveAgents() { User U = new User(); List ActiveUser = [SELECT Name , UserName, LastName FROM User WHERE IsActive = true]; for (User currentUser : ActiveUser) { U.add(currentUser.Name); U.add(currentUser.Username); } } }

Your answer

1 Answer

More QA Testing discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest QA Testing Blogs

Guides, tips and career advice on QA Testing from JanBask experts.