Skip to main content
in 3rd line created list of ID's List<ID> ids, then in 5th line [SELECT Name FROM Account WHERE ID in :ids];  .i think parameter ids has null values then how can we query like ID IN :ids...please explain me what will exists in the parameter of 'ids' in 3rd line...

public class AccountQueryAction {

@InvocableMethod(label='Get Account Names' description='Returns the list of account names corresponding to the specified account IDs.')

public static List<String> getAccountNames(List<ID> ids) {

List<String> accountNames = new List<String>();

List<Account> accounts = [SELECT Name FROM Account WHERE Id in :ids];

for (Account account : accounts) {

accountNames.add(account.Name);

}

return accountNames;

}

}
4 answers
  1. Mar 2, 2017, 5:35 AM
    Thanks vignesh for your reply. but that code was given by salesforce pdf document, i need explanation for that statement please what will exists in parameter ids
0/9000