• Hemant Kumar 145
  • 0 Points
  • Member since 2021

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1
Hi All,

Am getting  these errors while hitting check challenge.

trigger AccountAddressTrigger on Account (before insert, before update) {
    for(Account a: trigger.new){
        if(a.Match_Billing_Address__c == true && a.BillingPostalCode != null){
            a.ShippingPostalCode = a.BillingPostalCode;

We updated an account that had 'Match_Billing_Address__c' set to false. We expected the trigger not to fire, but it did. Make sure the trigger fires only if 'Match_Billing_Address__c' is true.

I have already deactive all the triggers and deleted the validation rule on Account object, but still am getting erros.

Please help me out,
Below is my code for the trigger for  duplicate prevention on the account . It works well, but if I have 50k records this impacts scalability and not feasible.
So please any one can help to code in better way.
thanks in advance.
trigger AccountDuplicate on Account (before insert) {
 List<Account> dup = new List<Account>();
 dup = [Select id, Name from Account];
 for(Account a:Trigger.New){
 for(Account a1:dup){
 a.Name.addError('Name already Exist ');