You need to sign in to do that
Don't have an account?
Giri Kumar B
Duplicate name not allowed i am write trigger . i am try to write test class can you please how to start write
class
--------
public class duplicateerrormsg {
public static void mains(list<account> acc){
list<string> a = new list<string>();
set<string> s = new set<string>();
for(account at: acc){
a.add(at.name);
}
list<account> acs = [select name from account where name in:a];
for(account a2:acs){
s.add(a2.name);
}
for(account a3:acc){
a3.name.adderror('this record has implument ');
}
}
}
--------
public class duplicateerrormsg {
public static void mains(list<account> acc){
list<string> a = new list<string>();
set<string> s = new set<string>();
for(account at: acc){
a.add(at.name);
}
list<account> acs = [select name from account where name in:a];
for(account a2:acs){
s.add(a2.name);
}
for(account a3:acc){
a3.name.adderror('this record has implument ');
}
}
}
1) http://amitsalesforce.blogspot.com/2015/06/best-practice-for-test-classes-sample.html
I hope you are calling above class from account trigger. Then try below code.
If not then try below code
Let us know if this will help you
this is the error
not duplicateerrormsg.main(List<Account>)
Please add s