Would you help me please~
I want to return the name of the account with the string parameter (Account's ID) handed over from JS!
I converted the id of the account to string in JS and handed it over to the apex class.
which is String accountIdList and it has data looks like a071s0000093T8hAAE, a071s0000093RDzAAM, a071s0000092WKRAA2
So i convert String accountIdList to List which is List<String> accountIdLists = accountIdList.split(',');
And i was supposed to turn for loop and add this ID to Set a = new Set(); I wanted to add it here, but it doesn't work!
I made Account list and wanted to return account1 and send the Id and Name of account back to JS!
List<Account> account1= [SELECT Id,Name FROM Account Where id in:a];
What should I do? Please help me, masters!
here is my hole code.
@AuraEnabled(cacheable=true)
public static List<Account> getChatterAccountName(String accountIdList) {
List<String> accountIdLists = accountIdList.split(',');
Set<Id> a = new Set<Id>();
for(String s :accountIdLists){
a.add(s);
}
List<Account> account1= [SELECT Id,Name FROM Account Where id in:a];
return account1;