-
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

5 Best Salesforce Features for Developers To Look in 2022
With the start of the year 2022, Salesforce's Spring '22 release is just around the corner. Now, it is a wonderful moment to talk about…

A Complete Guide to Integrating Salesforce with ERP Systems
In today’s interconnected business environment, integrating Salesforce with your Enterprise Resource Planning (ERP) system can provide significant operational efficiencies and strategic advantages. By bridging these…

Trailhead: Your Best Ally to Learn Salesforce
Salesforce is one of the most used platforms in the business ecosystem. That is why the skills required for its successful operation are growing rapidly.…
Popular Salesforce Videos
Manual & Apex Managed Sharing in Salesforce
In this video, we will talk about Manual Sharing and Apex Managed Sharing. Manual Sharing Manual Sharing is used to share the record Manually. For…
Salesforce: Everything You Need to Know About Order Management
THE GOAL: Which Salesforce Order Management application is best? Well, that depends…. Salesforce offers three primary applications for order management, and they all work extremely…
Sandbox Design Strategies for Enterprise Implementations
It is inevitable to avoid Sandboxes in most enterprise implementations. As different teams work on different processes like testing, development, pre-release, and final rollout, it…