You need to sign in to do that
Don't have an account?
![Devaraj 7 Devaraj 7](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
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