• Sequoyah
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I have a simple trigger that updates a field.  My test class is not passing, however gives 80% coverage on the trigger.  

Here is the trigger:

trigger Update_MQL on Lead (before insert, before update) {
for (Lead myLead : Trigger.new)
{
    if (myLead.MQL_Date__c == null && (myLead.Status =='MQL (Marketing Qualified Lead)' || myLead.Status == 'SAL (Sales Accepted Lead)'))
    {myLead.MQL_Date__c = system.today();
    }else { myLead.MQL_Date__c = myLead.MQL_Date__c;
    }
     }
     
}


Here is the test class:

@isTest 
public class TestUpdate_MQL {
    static testMethod void insertNewLead() {
    
    Lead newLead = new Lead();
    
    newLead.FirstName = 'Mike';
    newLead.LastName = 'DeMille';
    newLead.Status = 'MQL (Marketing Qualified lead)';
    newLead.LeadSource = 'Advertisment';
    
    insert newLead;
    
 
       System.assertEquals(system.today(), newLead.MQL_Date__c);
    
    }
    
    }


What needs to be fixed?
Hello,

I am trying to deactivate a Lead Trigger on our Salesforce Account. I deactivated the trigger in the Sandbox and tried to deploy it via Change Sets, but I received four errors that I'm not sure how to resolve. I am not a developer so I haven't been able to figure out what these errors mean and how to fix them. Here are the errors:

Class NameMethod NameError MessageTestUntouchedLeadReassignmentownerNoUsersSystem.AssertException: Assertion Failed: Expected: 0051300000CRGduAAH, Actual: null 
Stack Trace: Class.TestUntouchedLeadReassignment.ownerNoUsers: line 91, column 1
TestUntouchedLeadReassignmentreassignOwnerSystem.AssertException: Assertion Failed: Expected: true, Actual: false 
Stack Trace: Class.TestUntouchedLeadReassignment.reassignOwner: line 36, column 1
TestUntouchedLeadReassignmentreassignmentSystem.AssertException: Assertion Failed: Expected: 0051300000CRGdzAAH, Actual: null 
Stack Trace: Class.TestUntouchedLeadReassignment.reassignment: line 154, column 1
TestUntouchedLeadReassignmentupdateLeadStatusSystem.AssertException: Assertion Failed: Expected: true, Actual: false 
Stack Trace: Class.TestUntouchedLeadReassignment.updateLeadStatus: line 17, column 1

Is there anyone that could help me resolve these errors so I can deactivate the trigger? The trigger is causing some of our Workflow Rules to fire more than once and send out duplicate email notifications.

Thank you in advance!
--Katy Bartow