123ArticleOnline Logo
Welcome to 123ArticleOnline.com!
ALL >> Business >> View Article

What Is Apex Trigger In Salesforce?

Profile Picture
By Author: Chitiz Agrawal
Total Articles: 4
Comment this article
Facebook ShareTwitter ShareGoogle+ ShareTwitter Share

Apex is a powerful object-oriented programming language used for development within Salesforce.com. it allows developers to perform specific processes, such as executing flows, creating object relationships, executing transaction control statements on the platform of Force.com, a PaaS platform for simplified development.
Apex makes use of Java-like syntax to enable developers to add suitable business logic to specific system events like button clicks, updates of related records, and Visualforce pages.

What Is Apex Trigger?

Developers can perform specific actions within Salesforce.com with the help of Apex triggers. An Apex trigger allows you to perform customized actions before or after specific events to records within the Salesforce environment, such as making insertions, deletions, or updates. Apex provides developers with trigger support which is similar to the triggers supported by database systems.

An Apex trigger is generally used to perform activities that are based on specific conditions, for modifying related records within the database, or for restricting specific operations from taking ...
... place. Developers can use these triggers for performing all activities within Apex, including the execution of SOQL and DML operations and calling custom Apex methods.

It is advisable to use Apex triggers for performing activities that cannot be carried out using the point-and-click tools available on the Salesforce platform. Apex trigger examples will not include activities like updating a field on a record or validating a field value. You can use validation and workflow rules for carrying out these processes.

An Apex trigger is fired before or after the following major operations:
insert
delete
update
upsert
merge
undelete
Types Of Triggers

There are two different types of Apex triggers in Salesforce - before triggers and after triggers.

Before triggers are fired for updating and validating record values before they are saved to the database. On the other hand, after triggers are fired for accessing field values that are set by the system and for affecting changes in other records. The records firing the after triggers are read-only records.

Trigger Context Variables

All Apex triggers define specific variables contained in the System.Trigger class that allows developers to access run-time context.
Here are some of the major Apex trigger context variables and their functions:

Trigger.isExecuting – It returns true if the current context for the Apex code is a trigger instead of an Apex page, a web service, or an executeanonymous () API call.
Trigger.isInsert – It returns true if the trigger was fired from the Salesforce user interface, Apex, or the API for an insert operation.
Trigger.isDelete – It returns true if the trigger was fired for the purpose fo a delete operation from the Salesforce user interface, Apex, or the API.
Trigger.isUpdate – It returns true if the trigger was fired for the purpose of an update operation from the Salesforce user interface, Apex, or the API.
Trigger.isBefore – It returns true if the trigger is fired before a record was saved.
Trigger.isAfter – It returns true if the trigger is fired after all the records were saved.
Trigger.isUndelete – It returns true if the trigger was fired after a record being discovered from the recycle bin.
Trigger.new – It returns with a list of new versions of the Salesforce object records. This list is only available in insert, undelete, and update triggers and these triggers can only be modified in before triggers.

Trigger.old – It returns with a list of the old versions of the Salesforce object records. This list is available only in update and delete triggers.

The scope for using Apex triggers in Salesforce is huge. It allows developers to customize the platform according to the specific needs of the organization and leverage the use of the customer database.

Total Views: 798Word Count: 587See All articles From Author

Add Comment

Business Articles

1. Single Piece Flanged End Ball Valve Manufacturers In Ahmedabad, India – Mnc Valves
Author: mnc valves

2. A Simple Guide To Pitra Dosh And Kaal Sarp Puja At Trimbakeshwar
Author: Manoj Guruji

3. The Evolution Of Cnc Machined Components: What Oem
Author: Arrow Off-Road

4. How To Design A Step And Repeat Backdrop That Looks Professional?
Author: Steve Morgan

5. Spartan Jetter For Sale | Professional Hydro Jetting Equipment In Utah
Author: HotJet USA

6. Top 5 Factors To Consider When Selecting A Gasket
Author: Gasco Inc

7. Hiring In Mumbai Without The Chaos: A Practical Guide
Author: Digirecruitx

8. Bpo Outsourcing Company
Author: kajal

9. Renewable Energy Companies And The Challenge Of Grid Integration
Author: Hartek Group

10. How Freight Claims Management Works [2026 Updated]
Author: ArgusLogistics

11. Byst: Setting A New Standard In Business Mentorship Excellence
Author: Byst Youth

12. Voice And Visual Search: What Researchers Must Know
Author: Philomath Research

13. Let’s Build Your Bpo Business Together!
Author: Zoetic BPO Services

14. How To Spot Fake Copper And Brass Cookware At The Market
Author: Copper Brazier

15. Why More Industries Are Turning To Kyc Projects Right Now
Author: mohan

Login To Account
Login Email:
Password:
Forgot Password?
New User?
Sign Up Newsletter
Email Address: