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
masthan khanmasthan khan 

Challenge not yet complete... here's what's wrong: No Apex trigger named 'AccountAddressTrigger' was found

hai,
   i had tried this in badge from trailhead, though i had created apex trigger it is showing error.
Error
Challenge not yet complete... here's what's wrong:
No Apex trigger named 'AccountAddressTrigger' was found

Apex Trrigger
trigger AccountAddressTrigger on Account (before insert) {
    for ( Account a : Trigger.new ) {
        if ( a.BillingPostalCode != NULL && a.Match_Billing_Address__c == true )
            a.shippingPostalCode = a.billingpostalcode;
        insert a;
    }
}

Regards
Masthan Khan
Raj VakatiRaj Vakati
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;
        }   
    } 

}

Try the above code and 

Check is there any namespace in your org ..
Ajay K DubediAjay K Dubedi
Hi Masthan,

Please Try this code:-

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;
        }   
    } 
 }

Please check you any trigger you have on Account object which is creating opportunity? If yes then please deactivate the trigger and try again.
Please try to deactivate all other triggers and validation rules on Account object and try again.
Please try to activate AccountAddressTrigger trigger on Account object and try again.

Please mark as best answer if it helps you.

Thank You
Ajay Dubedi
Swapnagandha HawaldarSwapnagandha Hawaldar
Got the same error. Just started with a fresh trailhead playground, added checkbox to Account, copy-pasted trigger code from old playground developer console to new playground console and it worked. If you have tested your code and it is working fine, most of the times starting with a clean playground helps.