Apex Trigger’s New Design

As we know that salesforce keeps updating 3 times a year. With these releases, Salesforce introduces many new features in the apex code also. Earlier I was using the following approach when writing a trigger on any object.

But after getting Switch When and Trigger.operationType, I decided to use the below design for writing the trigger logic. This is more readable and looks more clear.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.