-
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
5 Best Sales Cadence Tools for Automating Your Outreach
Today, sales tools are more than simply "nice-to-haves". They assist sales representatives by automating routine processes and increasing overall sales effectiveness to free up time…
How to Register for the Salesforce Exam?
Are you looking to validate your expertise in the world of Salesforce? Salesforce certification exams provide a fantastic opportunity to showcase your skills and advance…
Top Features and Updates from Salesforce Winter’25 Release
Get ready to embrace the excitement of the Salesforce Winter '25 Release! This season's update is like the first snowfall, bringing a flurry of innovative…
Popular Salesforce Videos
How to Become a Salesforce Developer? No Programming Experience Needed
Salesforce Developer has once again been named one of the world's best jobs. In a list of 25 job roles, Salesforce was the only company…
Relationships in Salesforce | Why Relationships are Created?
In this video, Salesforce Rangers goes into detail about what relationships are in Salesforce and why they are necessary in the first place. This is…
How Is Salesforce Overcoming the Rise In Generative AI?
Discover how Salesforce is harnessing the power of Generative AI to revolutionize customer experiences, streamline processes, and innovate like never before. In this extract discover…