I'm not sure what I'm doing wrong but I have been trying few different way but I still able to get only on record instead of getting two records, yes I double check the data do exists.
Here is the what I'm trying to do:
pull the list of names which is comma separated from the custom labels.
string commaSeparatedString = System.Label.DirectorList; // there are two names with comma separated
String[] myList = new List<String>();
myList = commaSeparatedString.split(',');
System.debug('myList: ' + myList); //I see two names with comma separated
List<Account> rptList = [SELECT Id FROM Account WHERE Name IN : myList];
system.debug(rptList); //getting only one instead of two records.
My question: why is it showing only one record insterad of two records
my debug statement for : myList:
20:32:46:037 USER_DEBUG [11]|DEBUG|myList: (John Doe,
20:32:46:000 USER_DEBUG Jane Doe)
rptList:
20:47:43:025 USER_DEBUG [14]|DEBUG|(Account:{Id=0016w00000O7fKlAAJ, Name=Jane Doe})
String[] list = new String[]{'Jane Doe','John Doe'}; Account[] rptList = [SELECT Id, Name FROM Account WHERE Id IN: rptList];
- then you can look to see if there are any differences in your lists.