-
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
10 Commandments Of Becoming An Excellent Salesforce Administrator
Have you heard the entire hassle-bustle about Salesforce these days? Are you tantalized by the great Salary structures of various profiles in Salesforce? Well, you…
Introduction and How to Use Postman | Salesforce Developer Guide
Introduction Postman is a computer application it is used for testing APIs (Application Programming Interfaces). Postman sends an HTTP request to the webserver and receives…
Adopt Visualforce with new Lightning Experience
None of us are anymore oblivious of the fact that Salesforce Lightning Experience is a modern, productive user experience designed to multiply the efficiency manifold.…
Popular Salesforce Videos
Einstein For Marketing Cloud | The Learning Guide
AI has made things easy and smooth for any automation process. Einstein for Marketing Cloud provides insights and data to inform the content and timing…
Top 3 Things to See at Dreamforce 2021 | Salesforce
Three things you definitely don't want to miss at Dreamforce this year? 👆 #DF21 is packed with tons of educational content about your fave Salesforce…
Salesforce Lightning Tutorial | Build a Custom Lightning Home Page
This Salesforce Lightning Tutorial video by Edureka will help you understand what exactly is Salesforce lightning. It will also talk about some of the features…