-
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[] {'abc@gmail.com'}; mail.setToAddresses(toAddresses); mail.setReplyTo('abc@gmail.com'); 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

The 3 Approaches to Salesforce Implementation
Salesforce implementation in a business can be quite a challenge and a daunting task for employees. Whether you are a new user of a salesforce…

How Salesforce Can Greatly Improve B2B Sales
Every business-to-business channel has a unique set of challenges that require a different approach as opposed to B2C. Business-to-business (B2B) sales are transactions between businesses.…

These 5 Steps Will Help You Improve the Health of Your Salesforce Data
Companies struggling to maintain the quality health of their data should not expect the deluge of data to slow down anytime soon. In fact, the…
Popular Salesforce Videos
How To Build Better Communities with Salesforce Lightning?
Learn how you can customize Salesforce Community Cloud to fit your needs with the Lightning Bolt framework, Lightning Components and Community Builder.
Build a Simple Screen Flow with Salesforce Flow Builder
Did you know that you can build interactive custom components without any code? Flow Builder is a powerful tool for automation and for giving Admins…
Insert Data in Salesforce Using Standard Controller
Standard controllers provides ability to access and interact with structured business data contained in records displays in the proper user interface. Standard controller tasks: controlling…