-
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

Wrapper Class in Apex Salesforce | The Developer Guide
Wrapper Class in Apex Salesforce Wrapper Class in Apex Salesforce: A wrapper or compartment radiance is a class, a realities shape, or a unique data…

Why and How to be a Self Learnt Salesforce App Developer?
Do you want to be a Salesforce professional, then you are on the right track. Anyone either from a software background or fresher can start…

Reasons Why Commercial Banking Should Consider Moving to Salesforce Financial Services Cloud
The banking industry has completely transformed and now what matters the most is how a bank is able to deliver personal experiences to its customers…
Popular Salesforce Videos
Setting Up Service Territories and Operating Hours | Salesforce Webinar
Scale your business and ensure optimized performance by setting up service territories in Salesforce Field Service. In Salesforce Field Service, operating hours represent service territory…
CEPTES’s successful visit to Dreamforce’17
Thank you all to those who visited CEPTES at Dreamforce’17. It had been a great event and CEPTES would like to offer gratitude to our…
Things you can do with Loyalty Management in Salesforce to Create Lifelong Customers
Although keeping customers is not always simple, statistics show that when they are a part of an ongoing customer loyalty management program, they spend 67%…