• mehellie
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
@isTest
public class testContactServices{
    
    static testMethod void testTaskOnInsertHandler()
    {
        //Test.StartTest();
        // test Lead
        
       // Lead l = new Lead();
        
        
       // insert l;
        
        
        
        //Contact nc = new Contact();
        
    //insert nc;

        // test contact
          Task test = new Task();
    
          test.Type = 'Unqualified';
          test.Status = 'Completed';              
          test.WhoId = [select Id from Contact limit 1].Id; // to get an existing one.
          insert test;
            Map<ID,Task> contactmap = new Map<ID,Task>();
          contactmap.put(test.Id,test);
          
          ContactServices.taskOnInsertHandler(contactmap);
      
            // test lead
             Task test2 = new Task();

          test2.Type = 'Unqualified';
          test2.Status = 'Completed';              
          test2.WhoId = [select Id from Lead limit 1].Id; // to get an existing one.
          insert test2;
            Map<ID,Task> leadmap = new Map<ID,Task>();
          leadmap.put(test2.Id,test2);
      LeadServices.taskOnInsertHandler(leadmap);
     
        //Test.StopTest();
    }

}

 I'm probably missing something obvious, sorry. The referenced classes just push the "Type" field from a Task onto a "Task Type" field on the contact/lead. 

We have a custom Bill To object that populates address information onto the account. We have this snippet of code -

 

 

          a.BillingStreet = btst.Street_1__c!=null?btst.Street_1__c:''+' '+btst.Street_2__c!=null?btst.Street_2__c:'';

 

It is working correctly for Street 1, but Street 2 is not copying from Bill To to the Account. What could be the problem?

I have taken ADM201 and have been using/administrating SFDC for ~6 months. I want to learn more about development (mostly Apex) - do I need to take DEV401, or can I go ahead to DEV501? It seems like there's a lot of crossover between DEV401 and ADM201. Thanks in advance!

@isTest
public class testContactServices{
    
    static testMethod void testTaskOnInsertHandler()
    {
        //Test.StartTest();
        // test Lead
        
       // Lead l = new Lead();
        
        
       // insert l;
        
        
        
        //Contact nc = new Contact();
        
    //insert nc;

        // test contact
          Task test = new Task();
    
          test.Type = 'Unqualified';
          test.Status = 'Completed';              
          test.WhoId = [select Id from Contact limit 1].Id; // to get an existing one.
          insert test;
            Map<ID,Task> contactmap = new Map<ID,Task>();
          contactmap.put(test.Id,test);
          
          ContactServices.taskOnInsertHandler(contactmap);
      
            // test lead
             Task test2 = new Task();

          test2.Type = 'Unqualified';
          test2.Status = 'Completed';              
          test2.WhoId = [select Id from Lead limit 1].Id; // to get an existing one.
          insert test2;
            Map<ID,Task> leadmap = new Map<ID,Task>();
          leadmap.put(test2.Id,test2);
      LeadServices.taskOnInsertHandler(leadmap);
     
        //Test.StopTest();
    }

}

 I'm probably missing something obvious, sorry. The referenced classes just push the "Type" field from a Task onto a "Task Type" field on the contact/lead. 

I have taken ADM201 and have been using/administrating SFDC for ~6 months. I want to learn more about development (mostly Apex) - do I need to take DEV401, or can I go ahead to DEV501? It seems like there's a lot of crossover between DEV401 and ADM201. Thanks in advance!