Skip to content

Instantly share code, notes, and snippets.

@ganmahmud
Last active November 21, 2018 06:49
Show Gist options
  • Select an option

  • Save ganmahmud/44f4644c75f7bfda5c57a1cdc26ab67e to your computer and use it in GitHub Desktop.

Select an option

Save ganmahmud/44f4644c75f7bfda5c57a1cdc26ab67e to your computer and use it in GitHub Desktop.
Create a method for inserting accounts.
public class AccountHandler {
public static Account insertNewAccount(String accountName){
try{
Account acct = new Account(Name=accountName);
insert acct;
return acct;
}
catch (DmlException e){
System.debug('A DML exception has ocurred: ' + e.getMessage());
return (NULL);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment