function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ChinnoduChinnodu 

Write a trigger when an account insert happens trigger should check for the duplicates and should not be case sensitive (I,e it should allow either Lower or Upper case duplicate

Hi Experts ,
How to Write a trigger  "when an account insert happens trigger should check for the duplicates and should not be case sensitive (I,e it should allow either Lower or Upper case duplicate.

kindly help me 


Thanks,
Chinna
Divs@newbieDivs@newbie
Hello Chinna,

Hope the following helps :)
 
trigger AccountDuplicateTrigger on Account (before insert, before update)

{

     for(Account a:Trigger.new)

     {

           List<Account> acc=[Select id from Account where Name=:a.Name ];

           if(acc.size()>0)

           {

                  acc.Name.addError('You Cannot Create the Duplicate Account');

           }

     }

 }