Write a Apex trigger to Add the Contact First Name and Last Name to Associated Account Custom Field Whenever the Contact inserted or Updated in Salesforce | Trigger to update Associated Account Custom Field

Vijayk
2 min readFeb 21, 2021

--

Hey guys, today in this post we are going to learn about How to Write a Apex trigger to Add the Contact First Name and Last Name to Account Custom Field Whenever the Contact inserted or Updated in Salesforce.

➡ Real time scenarios:- Write a trigger on Contact and Add First Name and Last Name of Contact to Associated Account Custom Field Whenever Contact record is Inserted or Updated.

Files we used in this post example

ContactAccountTrigger.apxt

Apex Class Trigger

It will be fired whenever Contact Record is inserted Or updated

Parent Object:- Account

Parent Object (Account)

Trigger on Contact and updae the Associted Account Custom Field (updateContact__c)

Child Object (Contact)

It is child object and associated with Account Object.

Final Output To get source code live demo..

Other related post that would you like to learn.

Create Apex Class Trigger Controller

Step 1:- Create Apex Class : ContactAccountTrigger.apxt

From Developer Console >> File >> New >> Apex Class

ContactAccountTrigger.apxt [Apex Class Controller]

Other post that would you like to learn in LWC Further post that would you like to learn 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 February 21, 2021.

--

--

Vijayk
Vijayk

Written by Vijayk

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

No responses yet