-
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
9 Features That Make Salesforce Service Cloud the #1 Customer Service Solution
Salesforce Service Cloud – The Most Trusted Customer Service Platform Customer service holds the key to uplifting brand value in today’s fast-paced business world. As…
Top 10 New features of Salesforce Community Cloud Summer ’20 Release
Bonjour à tous! What a wonderful time of the year. With the sun shining brightly down, you want to forget everything happening around you and…
Popular Salesforce Videos
Salesforce Winter '23 Release Highlights - Video
Cosy up by the fireplace with a nice blanket and a cup of hot cocoa; Salesforce's Winter '23 update is as cool as ice! With…
Demystifying OAuth and Connected Apps
Often times, the first thing an application needs to do is authenticate its users. Developers building integrations with Salesforce need a simple and secure way…
PayPal + Salesforce | Democratizing Financial Services
Hear PayPal leaders share how Customer 360 has helped the company accommodate an increase in digital payments with a frictionless process that supports small and…