+ Start a Discussion
Kishan Kumar 77Kishan Kumar 77 

I have an object certification request which has a field status and email. I want to write a trigger which sends email when status is not approved to the user logged in and to the email mentioned in the email field.

This is the code that I have tried. Please help me complete it.

trigger OneToOne on Certification_Request__c (before insert, before update, after insert, after update) {
for (Certification_Request__c q : [SELECT Due_Date__c,Employee__c,Employee_s_Email__c,Status__c from Certification_Request__c]) {
        if(q.Due_Date__c<date.today() && (q.Status__c!='Approved' || q.Status__c!='Rejected'))

ShirishaShirisha (Salesforce Developers) 
Hi Kishan,


Please check the sample code provided in the below blog to send an email based on the field update:


Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri