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
Karen James 6Karen James 6 

Trigger error any help appreciated

Hi, I have an error on my trigger and can't work out why this is not working?
User-added image
Best Answer chosen by Karen James 6
Andy BoettcherAndy Boettcher

Karen,

All custom fields need to have the "__c" suffix appended - the error you're seeing is on lines 13-18:

 

a.ZoomInfo_Country__c = a.ZoomInfoCountry__c;
a.ZoomInfo_Street__c = a.ZoomInfoStreet__c;
a.ZoomInfo_City__c = a.ZoomInfoCity__c;
a.ZoomInfo_Country_State_Province__c = a.ZoomInfoCountryStateProvince__c;
a.ZoomInfo_Postal_Zip_Code__c = a.ZoomInfoPostalZipCode__c;
a.ZoomInfo_Website__c= a.ZoomInfoWebsite;

All Answers

Andy BoettcherAndy Boettcher

Karen,

All custom fields need to have the "__c" suffix appended - the error you're seeing is on lines 13-18:

 

a.ZoomInfo_Country__c = a.ZoomInfoCountry__c;
a.ZoomInfo_Street__c = a.ZoomInfoStreet__c;
a.ZoomInfo_City__c = a.ZoomInfoCity__c;
a.ZoomInfo_Country_State_Province__c = a.ZoomInfoCountryStateProvince__c;
a.ZoomInfo_Postal_Zip_Code__c = a.ZoomInfoPostalZipCode__c;
a.ZoomInfo_Website__c= a.ZoomInfoWebsite;
This was selected as the best answer
Karen James 6Karen James 6
Andy I have a further error now further down having fixed the section 12-18.



        
        // map any other fields you would like 
        
        // Now preserve the standard fields when editing
        if (Trigger.isUpdate == true) {
            a.AnnualRevenue = trigger.oldmap.get(a.Id).AnnualRevenue;
            a.NumberOfEmployees = trigger.oldmap.get(a.Id).NumberOfEmployees;
            a.Description = trigger.oldmap.get(a.Id).Description;
            a.ZoomInfoCountry = trigger.oldmap.get(a.Id).ZoomInfoCountry;
            a.ZoomInfoStreet = trigger.oldmap.get(a.Id).ZoomInfoStreet;
            a.ZoomInfoCity = trigger.oldmap.get(a.Id).ZoomInfoCity;
           a.ZoomInfoCountryStateProvince = trigger.oldmap.get(a.Id).ZoomInfoCountryStateProvince;
           a.ZoomInfoPostalZipCode = trigger.oldmap.get(a.Id).ZoomInfoPostalZipCode;

        }
        }       
    } 
}
Invalid field AnnualRevenue for SObject Account_Management__c

Not sure why its come up on first line and seems to be referring to a different object?

Thanks for your help, Karen.
Andy BoettcherAndy Boettcher
I'm thinking that your trigger is on the Account_Management__c object?  Could you post the whole trigger here?
Karen James 6Karen James 6
Andy Yes I am an idiot picked up wrong object!!!!! I am so novice
Andy BoettcherAndy Boettcher
Don't worry!  That's how we all learn.  Good luck and let us know if you have any more questions!