public class meList{ public static void UpsertAcct() { Account a1 = new account(name='MyAccount1', description='My test account1'); Account a2 = new account(name='MyAccount2', description='My test account2'); List<Account> meAcct = new List<Account>(); meAcct.add(a1); meAcct.add(a2); try { upsert meAcct; } catch (DmlException e) { System.debug(e.getMessage()); } } public static void getAcct() { list<account> myAccounts = new list<account>(); myAccounts = [Select Name From Account]; for (Account a : myAccounts ){ system.debug(a.Name); } } public static void getListArray() { List<String> meString = new List<String> {'one','two'}; meString.add('Three'); for (String meS : meString) { system.debug('Here Kid=>' + meS); } } }
SFDC List Method
This entry was posted in Development and tagged List Account, List String, for loop, list, loop. Bookmark the permalink.