What should a developer keep in mind when writing an Apex Trigger? - ProProfs Discuss
Advertisement

What should a developer keep in mind when writing an Apex Trigger?

Asked by Sonnd, Last updated: Nov 30, 2022

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

sonnd568

sonnd

sonnd568
Sonnd

Answered Jul 25, 2019

A. An Apex Trigger should be logic-less and delegate the logic responsibilities to a handler class.
B. A single Apex Trigger is all you need for each object.

A single Apex Trigger is all you need for one particular object. If you develop multiple Triggers for a single object, you have no way of controlling the order of execution if those Triggers can run in the same contexts. Another widely-recognized best practice is to make your Triggers logic-less. That means, the role of the Trigger is just to delegate the logic responsibilities to some other handler class.

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.