Triggers – Send email after deleting a record.

Triggers – Send email after deleting a record.

Trigger
Triggers - Send email after record deletion. There are occasions in which you want to notify a person or a group of people when a record/s has been deleted. To accomplish this you can write a trigger that will send an email to those that need to be informed about this action. We will write a trigger here that will do exactly that, it will send an email to one email address if a record gets deleted. We are not going to write the full logic in the trigger's body. We are going to build a helper class to take care of the execution of our logic and we are going to invoke this helper class from all class. So let's start by writing out ONE AND ONLY trigger for…
Read More
Triggers – Helping to catch duplicates

Triggers – Helping to catch duplicates

Trigger
Triggers - Helping to catch duplicates. One way in which triggers can be of great help is by using them to catch duplicates records before insertion or before doing an update. Probably the easiest way to do this is by making sure you have implemented a unique key identifier on those records that you want to control and make sure that will not contain any duplicates. The unique identifier needs to be, well... 'unique', and no other record should contain that same key. Depending on the object in which you want to implement your "duplication preventer" you need to come up with that field that will contain your unique identifier. Let's take the Lead object for our test here, and I am going to use two unique values fields. Normally…
Read More
Triggers

Triggers

Trigger
They are, the triggers (Basics). As you probably know, triggers are one of the two Apex types we have to our disposal when developing with Apex. The most relevant difference between an Apex class and a trigger is the particular occasions in which triggers are used. They are related to DML, (Data Manipulation Language) operations. To keep it simple, when and execution operation fires actions like insert, update, delete, and undelete. These operations can be executed in a kind of "time frame"...nothing fancy, we can set the 'before' and 'after' attributes to our trigger to implicitly tell our trigger when to fire. An important factor when writing triggers is the fact that they run on system content, meaning this that there is not user reinforcement on access level or access…
Read More