You need to sign in to do that
Don't have an account?
AlSawtooth
How can I bulkify this trigger?
trigger UpdateEmployerAddress on Contact (before insert, before update) { Set<String> setoforgs = new Set<String>(); for (Contact inloop : Trigger.new) { if(inloop.Employer_Lookup__c !=null) { List<Organization__c> orgs = [SELECT Id, Mailing_Street__c, Mailing_City__c, Mailing_State__c, Mailing_Zip_Code__c, Mailing_Country__c FROM Organization__c WHERE Id = :inloop.Employer_Lookup__c]; if(orgs.size()>0){ for (Organization__c o :orgs){ inloop.cv__Employer_Street__c = o.Mailing_Street__c; inloop.cv__Employer_City__c = o.Mailing_City__c; inloop.cv__Employer_State__c = o.Mailing_State__c; inloop.cv__Employer_Postal_Code__c = o.Mailing_Zip_Code__c; inloop.cv__Employer_Country__c = o.Mailing_Country__c;} }}}}
Below code helps you