Skip to content

Instantly share code, notes, and snippets.

@JimBTek
Created February 24, 2017 15:01
Show Gist options
  • Save JimBTek/edb0c35a5d2719b36c5c37703dbcffa9 to your computer and use it in GitHub Desktop.
Save JimBTek/edb0c35a5d2719b36c5c37703dbcffa9 to your computer and use it in GitHub Desktop.
Trailhead Apex method
public class AccountHandler {
public static String insertNewAccount(String acctName) {
Account acct = new Account (Name = acctName);
try{
insert acct;
Account returnAcct = [select id, Name from Account where Name = 'acctName' limit 1];
}
catch (DmlException e) {
System.debug('A DML exception has occurred: ' + e.getMessage());
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment