Created
February 11, 2020 07:07
-
-
Save cdeckert/38c913df023dcc780001d32837cc497c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy mailing street to contact | |
trigger on Account (before insert, before edit) | |
{ | |
List<Account> accounts = [SELECT ID, MailingStreet FROM Account WHERE AccountId = trigger.new]; | |
for(int i = 0; i < accounts.length(); i++) | |
{ | |
Account a = accounts[i]; | |
List<Contact> contacts = [SELECT ID, MalingStreet from Contact WHERE AccountId = a.Id]; | |
for(Contact c : contacts) | |
c.MailingStreet = a.MailingStreet; | |
update c; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment