본문 바로가기
Salesforce/Trailhead

Developer Beginner | Apex Basics & Database | Manipulate Records with DML

by proudofch 2021. 3. 19.
public class AccountHandler {
    public static Account insertNewAccount(String name) {

        Account answer = null;        
        try {
            Account acct = new Account(Name = name);
            insert acct;
            ID acctId = acct.Id;
            answer = [SELECT Name from Account WHERE Id=:acctId];
        } catch (DmlException e) {
            System.debug(e.getMessage());
        }
        return answer; 
        
    }    
}

Challenge Code 통과

 

빈 문자열 넣으면 아래와 같이 log 찍힘

 

댓글