Trigger to update dependent contact’s mailing address if parent contact’s mailing address changes.

Trigger to update dependent contact’s mailing address if parent contact’s mailing address changes.

First, we gather all contacts record that have changed, then we query for all dependent contacts and see if any mailing address value changes from the old values on parent contact, and if so, add them to a list to update, and finally we update the records.

Create a custom lookup field on standard contact object named: Contact__c relationship: Lookup(Contact)

You might want to make it update to copy parent contacts address to child either the entire address or a specific field by field, but I thought I have made it simple to give you an idea that it certainly can be done.

Gopal Das
Follow me

Gopal Das

Founder at GopalDas.Org
He is a technology evangelist, Salesforce trainer, blogger, and working as a Salesforce Technical Lead. After working in Java based project implementation, he jumped to the Salesforce system on a whim and never looked back. He fell in love with Salesforce’s flexibility, scalability, and power. He expanded his knowledge of the platform and became a Certified App Builder, Administrator, Platform Developer I, SalesCloud Consultant while leading the Salesforce implementation and technology needs. He has worked in a wide variety of applications/services like desktop, web and mobile applications.
Gopal Das
Follow me

Leave a Reply

Your email address will not be published. Required fields are marked *