-
In below code snippet in Salesforce, what is going wrong?
In below code snippet,
trigger TestBeforeDelete on Lead (before Delete) { for(Lead l : Trigger.Old) { l.addError('error'); } String msgBody = 'Test Email'; String Subject = 'Test from Cogni Force on Lead'; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddresses = new String[] {'[email protected]'}; mail.setToAddresses(toAddresses); mail.setReplyTo('[email protected]'); mail.setSenderDisplayName('Cogniforce Test Simulator'); mail.setSubject(Subject); mail.setPlainTextBody(msgBody); mail.setHTMLBody(msgBody); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); }
What is your observation and what is going wrong?
Log In to reply.
Popular Salesforce Blogs

Build Dynamic Customer Journey to salesforce
The term “customer journey” refers to the stages a customer goes through in his relationship with your Business. Since today brands are promoted using all…

Modernize your Business with Salesforce hasten Applications
Salesforce is the world’s largest customer relationship management(CRM) tool provider which allows companies to connect with their customers in a completely new way. The CRM…

What is Salesforce Community Cloud? Learn About its Features and Benefits
What is Salesforce Community Cloud? Salesforce Community Cloud is an online social platform for businesses to create branded pages that connect customers, employees, and partners.…
Popular Salesforce Videos
Salesforce Automation Tools
What all automation tools available in Salesforce? Learn more about automation tools - a) Process Builder b) Lighting Flow c) Approval process d) Workflow rules…
How to implement Salesforce shield in 20 min?
Many organizations have “bought” Salesforce Shield but haven’t implemented it yet, due to some complexities that come along with security-related products. Pete and Brian will…
Control Access to the Org | Data Security | Salesforce
In this video, wonder Studies explains how to control access to your Salesforce org and the data security measures you can take to protect your…