Write a trigger to update parent account phone number whenever the contact phone number is updated using trigger handler and helper class in Salesforce | How to update Account phone from Contact Phone based on lookup relationship in Salesforce

Vijayk
3 min readAug 8, 2021

--

Hey guys, today in this post we are going to learn about How to Write a trigger to update parent account phone number when ever the contact phone number is updated using trigger handler and helper class in Salesforce

Real time scenarios:- Write a trigger on Contact to update the parent Account Phone number when ever the Contact Phone is updated through trigger handler and helper class in Salesforce.

Files we used in this post example

contactTrigger.apxt

Apex Class Trigger

It will be fired when ever contact phone number is updated.

contactTriggerHandler.apxc

Apex Class Trigger Handler

Apex handler trigger to update account phone number with contact phone number when ever contact is updated.

Parent Object:- Account
Fields:- Phone
Child Object:- Contact
Fields:- Phone, AccountId (Lookup)

Trigger to updated parent Account from Contact based on lookup relation AccountId.

Final Output To get source code live demo..

Other related post that would you like to learn.

Create Apex Class Trigger

Step 5:- Create Apex Class : contactTrigger.apxt

From Developer Console ➡ File ➡ New ➡ Apex Class

contactTrigger.apxt [Apex Class Controller]

Create Apex Trigger Handler and Helper Class

Step 5:- Create Apex Class : contactTriggerHandler.apxc

From Developer Console ➡ File ➡ New ➡ Apex Class

contactTriggerHandler.apxc [Apex Class Controller]

Further post that would you like to learn in LWC To Find Some Important Additional Information

If you think you and your family members also like to earn money in additional time, then go this link. In this site, you can earn money for the lifetime at low effort. To Earn Unlimited Everyday With This Trick, Sign Up Free and Get Magic.. Get Started for Free

Check Out Youtube:- Earn Unlimited Everyday With This Trick:- Click Here

FAQ (Frequently Asked Questions)

Final Output To get source code live demo..

Hi, This is Vijay behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

Originally published at https://www.w3web.net on August 8, 2021.

--

--

Vijayk
Vijayk

Written by Vijayk

Easy to learn step-by-step online tutorial by www.w3web.net

No responses yet