You need to sign in to do that
Don't have an account?

what is the best practice for below trigger i want to prevent duplicate phone in my account
trigger predupphone on Account (before insert) {
for(Account a:trigger.new)
{
list<Account> la= [select id from Account where phone=:a.Phone];
if(la.size() > 0)
{
a.Phone.adderror('phone already exist');
}
}
for(Account a:trigger.new)
{
list<Account> la= [select id from Account where phone=:a.Phone];
if(la.size() > 0)
{
a.Phone.adderror('phone already exist');
}
}
https://salesforce.stackexchange.com/questions/115638/trigger-to-check-duplicate-on-phone