-
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
AI-Empowered Support - Gain Customers Who Recommend You
The rise of Artificial Intelligence (AI) has revolutionized the way businesses operate, and the Salesforce ecosystem is no exception. One area where AI has made…
Why Manual Testing Is Quietly Killing Your Salesforce Releases
If you've ever pushed a Salesforce release on a Friday afternoon and spent the weekend refreshing your phone waiting for a bug report, you already…
Pardot Vs HubSpot - Choosing The Best Marketing Automtion Tool | Salesforce
It is a frequently asked question among organizations whether they should go for Pardot Vs HubSpot for their marketing automation requirements. It’s important to choose the…
Popular Salesforce Videos
Soar: A Salesforce Philanthropy Film
When one of us is lifted up, all of us are lifted up. ? That's why we're supporting #GoGiveOne, a campaign to advance global vaccine…
Salesforce Sandbox Tutorial | Salesforce Training Videos For Beginners
The Salesforce Sandbox is a copy of a production Salesforce environment used for a variety of purposes, commonly including testing and development. Here's how Salesforce…
How to Learn Salesforce in easy step by step and get certified
From Salesforce instructor, Become a Salesforce Expert. Learn Salesforce step by step and get certified easily.