• Neo Nem
  • NEWBIE
  • 5 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I have this Test Class code and I am not sure what I am doing wrong to get the 2 errors.

isTest
private class EmailServiceExampleTest
{
    static testMethod void testUnsubscribe() 
    {
       // Create a new email and envelope object.    
       
       Messaging.InboundEmail email = new Messaging.InboundEmail() ;
       Messaging.InboundEnvelope env    = new Messaging.InboundEnvelope();
    
       // Create Test record.
       Contact cont = new Contact(firstName='john', lastName='smith', Email='test@test.com', HasOptedOutOfEmail=false);
       insert cont ;
       
       // Test with the subject that matches the unsubscribe statement.
       email.subject = 'Test Contact Email';
       email.plainTextBody = 'Test Contact Email';

       env.fromAddress = 'test@test.com';
       EmailServiceExample obj= new EmailServiceExample();
       obj.handleInboundEmail(email, env );



I am getting these 2 errors:
Line 20 - Invalid Type: EmailServiceExample
Line 21 - Variable does not exist: obj
 
Okay fellas, this one is a toughie.

I have a trigger that is before update on object A. I have a field on the same object which is updated by a process.

I need to somehow make an if statement in the trigger NOT to fire if the value in the field is changed. This is a before update trigger. Is it even possible?