-
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
Apex Trigger Scenarios | All You Need to Know
Here's a list of Apex trigger scenarios questions for practice, covering beginner to intermediate levels and Intermediate to Advanced levels: Beginner Level Intermediate Level Advanced…
Application Events In Salesforce Lightning Framework
In Salesforce Lightning, if we need to pass data from one component to another within an application , we can use Lighting Events. For example:…
Salesforce Agentforce for Nonprofits
Nonprofits are constantly faced with the challenge of meeting growing demands with limited resources and inefficient processes. When your constituents need help or information, you…
Popular Salesforce Videos
How to Prepare for Salesforce Platform App Builder (CRT-402) ?
The Salesforce Platform App Builder certification focuses on the different declarative functions available to an admin. Development and code are not included, but it focuses…
Salesforce Tutorial For Beginners | Introduction To Salesforce | Salesforce Training
This video on Salesforce training will help you understand the easy and best tool for CRM and Branding. You will learn how to customize the…
Salesforce Certifications 2022 | Which Certifications You Need & Why You Need Them
If you’re looking to start a Salesforce job this year you’re going to need a Salesforce certification. But where do you start, which certification should…