You need to sign in to do that
Don't have an account?
Surender
Requirement to store User names in an String array with iterating these 20 records
Hi,
I have SOQL which retrieves 20 User records. I have a requirement to store User names in an String array with iterating these 20 records.
Can someone reply on how to accomplish this.
Thanks in advance.
Hi,
Try the below code snippet as Reference:
List<User> us=new List<User>();
us=[Select id,Name from User];
List<String> usernamestr=new List<String>();
for(User u:us)
{
usernamestr.add(u.name);
}
for(String strnme:usernamestr)
{
system.debug('______each user in loop________'+strnme);
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.