Write a trigger whenever Opportunity is deleted the corresponding Account and Contact should be deleted uses of Apex trigger in Salesforce | Write a trigger on Opportunity to delete corresponding Account and contact of opportunity using Apex trigger in Salesforce

Vijayk
2 min readMay 16, 2022

Hey guys, today in this post we are going to learn about How to write a apex trigger whenever opportunity is deleted the corresponding account and contact should be deleted uses of Apex trigger in Salesforce.

Real time scenarios:- Write a trigger on Opportunity when Opportunity is deleted the corresponding Account and Contact should be automatic deleted.

Apex Triggers

Apex can be invoked by using triggers. Apex triggers enable you to perform custom actions before or after changes to Salesforce records, such as insertions, updates, or deletions.

A trigger is Apex code that executes before or after the following types of operations:-

To know more details about Apex Triggers, Click Here →

Final Output → To get source code live demo..

Other related post that would you like to learn in LWC

Create Apex Trigger

Step 1:- Create Apex Trigger : OpportunityDeleteTrigger.apxt

From Developer Console >> File >> New >> Apex Trigger

OpportunityDeleteTrigger.apxt [Apex Trigger]

Further post that would you like to learn in LWC FAQ (Frequently Asked Questions) Does After trigger work on delete? What is trigger isInsert? What is the difference between trigger new and trigger old?

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 May 16, 2022.

--

--