• pooja kadam
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi,

I am getting the error  "Illegal assignment from LIST<CampaignMember> to LIST<CampaignMember> at line 6 "

Can nyone please help?



public with sharing class CampaignMemController {

    public Campaign camp {get; set; }
    list<contact> con = [SELECT id FROM contact];
    
    list<campaignmember> cmlist = [SELECT id, contactid FROM campaignmember];
    list<contact> conlist = new list<contact>();
     public CampaignMemController(ApexPages.StandardController controller) {
         camp  = (Campaign)controller.getRecord();
  
  
    for(campaignmember cm : cmlist)
{
     for(contact c : con)
    {
             if(c.id == cm.contactid)
                              conlist.add(c);
     }
    
//System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
        }  
    } 

}
I am new to Apex development, and am trying to figure out how to get past the !lead.isConverted part of my Trigger in the Test case.  The test case is only making it to the IF Statement of the Trigger.

Thank you in advance for your help.
trigger LeadConvertVerified on Lead (after Update) {
string convertStatus = 'Closed - Converted';
List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();
for (Lead lead: Trigger.new) {
   if (!lead.isConverted && lead.Verified__c == True){
    Database.LeadConvert lc = new Database.LeadConvert();
    lc.setLeadId(lead.Id);
    lc.setAccountId(lead.Organization__c);
    lc.setDoNotCreateOpportunity(TRUE);
    lc.ConvertedStatus= convertStatus;
    leadConverts.add(lc);
        }
    }
if (!leadConverts.isEmpty()) {
List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts);
}
}

@istest
private class LeadConversionTriggerTestClass {

Static testMethod void LeadConvertTriggerTestClass() {
//Test Against Verified Lead
  Lead l1 = New Lead();
   l1.IsConverted = False;
   l1.FirstName = 'TestOne';
  l1.LastName = 'Testing';
  l1.Organization__c = '001L000000TSsoD';
  l1.Email = 'testone@testing.com';
  l1.Company = 'Individual';
  l1.Verified__C = True;
  insert l1;
    Database.LeadConvert lc = new database.LeadConvert();
         lc.setLeadId(l1.Id);
         LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
         lc.setConvertedStatus(convertStatus.MasterLabel);
         Database.LeadConvertResult lcr = Database.convertLead(lc);
    
//Test Against Un Verified Lead
Lead l2 = New Lead();
    l2.IsConverted = False;
  l2.FirstName = 'TestOne';
  l2.LastName = 'Testing';
  l2.Organization__c = '001L000000TSsoD';
  l2.Email = 'testone@testing.com';
  l2.Company = 'Individual';
  l2.Verified__C = False;
  insert l2;    
    Database.LeadConvert lc2 = new database.LeadConvert();
         lc.setLeadId(l2.Id);
         LeadStatus convertStatus2 = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
         lc.setConvertedStatus(convertStatus2.MasterLabel);
         Database.LeadConvertResult lcr2 = Database.convertLead(lc);
  }
  }

<apex:actionfunction>  ,  <apex:commandbutton>

these two componets are invoke the controller mathods , waht is major difference between these two.

 

thank u .