-
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
Lightning Data Service (LDS) in Salesforce
If we have a lightning application that Creates, Reads, Updates or Deletes a record (basically CRUD operations) in the Salesforce database, Lightning Data Service (LDS)…
Salesforce Lead Conversion Rates: Benchmark vs Industry Reality
A low lead conversion rate isn't always a sales problem. In many Salesforce implementations, the real bottleneck lies in CRM configuration, automation, and data quality.…
Salesforce Apex Trigger
By using Apex triggers, you may execute custom code before and after specific Salesforce record events, such as inserts, changes, and deletes. Apex offers trigger…
Popular Salesforce Videos
Successfully Retrieving Metadata From Salesforce org Using Packages
In this session, we will uncover various strategies that developers can use to pull metadata from Salesforce org successfully. Watch this video and learn everything.…
Salesforce Contact Tracing for Employees Demo
As businesses gradually reopen after worldwide closures, many people feel concerned about the second spike in COVID-19 cases. To ensure public safety, local officials have…
How to Deactivate Salesforce Users
In this video, we'll show you how to Deactivate Salesforce Users. In Salesforce, you cannot delete users outright, as other references to the user may…