-
What is wrong in my Salesforce Trigger Test Class which updates IsUnreadbyOwner field to False?
I have written a simple Salesforce Trigger. I want to update the IsUnreadbyOwner field to False once a lead becomes unqualified.
My Trigger is:
trigger UnqualifiedLead on Lead (after update) { for(Lead lead: Trigger.new) { if (lead.Status == ‘Unqualified’) { lead.IsUnreadByOwner = False; } } }
My Test class is:
@isTest private class UnqualifiedLeadTest { static testMethod void myUnitTest() { // Setup the lead record Lead lead = new Lead(); lead.LastName = ‘last’; lead.FirstName = ‘First’; lead.Company = ‘Company’; lead.Status = ‘Unqualified’; lead.IsUnreadByOwner = True; insert lead; } }
Log In to reply.
Popular Salesforce Blogs
Lightning Web Components — Build Lightning Fast Salesforce Apps
Salesforce launched Lightning Web Components as part of Spring ’19 pre-release to enable a quicker and easier way to program applications on the Salesforce Lightning platform. It…
Salesforce Revenue Cloud: The All-In-One Solution For Your Business Growth
Throughout the sales life cycle a company faces innumerable challenges. One of the most overwhelming moments takes place at the end of the cycle, when…
How to Show and Update External Data in Salesforce without consuming Salesforce Data Storage?
This is a common case when a customer wants you to integrate some system with Salesforce so that external data is displayed in Salesforce preferably…
Popular Salesforce Videos
Data Archiving in Salesforce | Backup and Restore
Learn the techniques, patterns and strategies when it comes to handling data archiving, backup and restores. Watch this video and learn all about it, do…
Salesforce Winter '22 Product Release Highlights!
Watch this video to learn about the Salesforce Winter '22 Product Release Highlights. 0:00 - Winter Release Preview 0:10 - Pipeline Inspection Enhancements 0:23 -…
Data Import: Clean and Prepare Your Data Using Excel | Salesforce
Cleaning and Preparing Data Using Excel covers several features and functions that will make quick work of getting your data files ready for import. Vlookup,…