database merge in apex

Solutions on MaxInterview for database merge in apex by the best coders in the world

showing results for - "database merge in apex"
Hannes
29 Feb 2017
1 
2List<Account> accList = new List<Account>{new Account(Name='Myacc1'),new Account(Name='MyAcc2')};
3insert accList;
4 
5Account masterAcct = [SELECT Id, Name FROM Account WHERE Name = 'Myacc1' LIMIT 1];
6Account mergeAcct = [SELECT Id, Name FROM Account WHERE Name = 'MyAcc2' LIMIT 1];
7 
8try {
9 merge masterAcct mergeAcct;
10} catch (DmlException e) {
11 // handle the exception
12}
13 
14
similar questions
queries leading to this page
database merge in apex