Answers for "database.merge in apex"

SQL
0

database.merge in apex

 
List<Account> accList = new List<Account>{new Account(Name='Myacc1'),new Account(Name='MyAcc2')};
insert accList;
 
Account masterAcct = [SELECT Id, Name FROM Account WHERE Name = 'Myacc1' LIMIT 1];
Account mergeAcct = [SELECT Id, Name FROM Account WHERE Name = 'MyAcc2' LIMIT 1];
 
try {
 merge masterAcct mergeAcct;
} catch (DmlException e) {
 // handle the exception
}
 
Posted by: Guest on July-19-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language