I am trying to write a Trigger for before insert event on Account object.
trigger DeduplicationAccount on Account (before insert) {
//Get all the accounts in action in 'insert'
Account[] inputAccountList = Trigger.NEW;
I am trying to get a relative list of accounts in my input list of accounts. Say for eample, I am trying to get such accounts where the last name = 'XXX' in my trigger new.
So, i am writing like this: // Here, listOfSurname is containing a list of surname with 'XXX'
for(Account ac: Trigger.new){
List<Account> accountDuplicate = [Select ac.rr_First_Name__c, ac.rr_Last_Name__c From
Account ac where ac.rr_Last_Name__c IN : listOfSurname];
System.debug('accountDuplicate: '+ accountDuplicate);
}
But, this list is always coming as 0 though im my input,an account have surname as 'XXX'.