Last active
November 21, 2018 06:49
-
-
Save ganmahmud/44f4644c75f7bfda5c57a1cdc26ab67e to your computer and use it in GitHub Desktop.
Create a method for inserting accounts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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