• rock.goud
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Code:
global void ConstructExclustionCriteria(string ProductName,String City)
{
DripExclusionConditions__c exclustionCriteria=DripExclusionConditions__c.getInstance(ProductName.toLowerCase());
LeadOfferingStatus=exclustionCriteria.Product_Offering_Status__c.split(',');
LeadLastKnownStatus=exclustionCriteria.Last_Known_Status__c.split(',');
LeadValidity=exclustionCriteria.Lead_Validity__c.split(',');
MainStatusCodeF=exclustionCriteria.Main_Status_Code_F__c.split(',');
QualityCheck=exclustionCriteria.Quality_Check__c.split(',');
LeadWrittenOff=true;
CityName=City;
mProductName=ProductName;
exclustionQuery= ' Where Product_Offering_Type__c=:mProductName and IsConverted = false and DP_WriteOff__c !=:LeadWrittenOff and OGL_Positive__c=false and Status not in:LeadOfferingStatus and Lead_Vaildity__c not in:LeadValidity and Last_know_Status__c not in:LeadLastKnownStatus and Main_Status_Code_F__c not in:MainStatusCodeF and Quality_Check__c not in : QualityCheck ';
LeadRefereneExclustionQuery=' Where Lead__r.Product_Offering_Type__c=:mProductName and Lead__r.IsConverted = false and Lead__r.DP_WriteOff__c !=:LeadWrittenOff and Lead__r.OGL_Positive__c=false and Lead__r.Status not in:LeadOfferingStatus and Lead__r.Lead_Vaildity__c not in:LeadValidity and Lead__r.Last_know_Status__c not in:LeadLastKnownStatus and Lead__r.Main_Status_Code_F__c not in:MainStatusCodeF and Lead__r.Quality_Check__c not in : QualityCheck ';
}
public String MonthlySchedulingQuery
{
get
{
strDependentAction.add('Wrong Number');
strDependentAction.add('WN');
//
cluster.add('DNC');
cluster.add('NO NUMBER');
dialerStatusMonthly.add('WN');

MainQuery='Select Id, Name, Lead_City__c, Lead_Cluster__c, Lead_Priority__c, Mailer_Mode__c, MobilePhone, Email, HasOptedOutOfEmail, HasOptedOutOfFax, Product_Offering_Type__c, Non_Connects__c, IsConverted, Exclude_All__c, Loan_Amount1_offer__c, Main_Status_Code__c, Dependent_Action__c, Total_SMS_failed__c, Total_SMS_sent__c,TOTAL_RPC_R__c,Total_Not_interested_Count__c,LeadSource From Lead ';
MainQuery += exclustionQuery;
MainQuery += ' and (IsInDripCampaign__c=0 or IsInDripCampaign__c=null) and Lead_City__c=:CityName ' ;
MainQuery += ' and ( ';
MainQuery += ' Lead_Cluster__c in:cluster ';
MainQuery += ' OR ';
MainQuery +='(( Non_Connects__c > 25 OR (Non_Connects__c > 10 AND Total_SMS_failed__c >= 5) OR (Main_Status_Code__c=:strDispositionStatus or Dialer_Status__c in:dialerStatusMonthly)) AND Last_RPC_date__c=null) ';
MainQuery +=' OR ';
MainQuery+=' Dependent_Action__c in:strDependentAction ';
MainQuery+=' )';
/*
(Lead_Cluster__c in:cluster) OR (Non_Connects__c > 25 or (Non_Connects__c > 10 AND Total_SMS_failed__c >= 5) OR (Main_Status_Code__c=:strDispositionStatus) ) ';


MainQuery+=')'
MainQuery += ' and ((Lead_Cluster__c in:cluster) OR(( Non_Connects__c > 25 or (Non_Connects__c > 10 AND Total_SMS_failed__c >= 5) or (Main_Status_Code__c=:strDispositionStatus or Dialer_Status__c in:dialerStatusMonthly)) and Last_RPC_date__c=null))' ;
MainQuery += ' or Dependent_Action__c in:strDependentAction) ';
//MainQuery += ' and IsInDripCampaign__c=0 and Lead_City__c=:CityName and (Lead_Cluster__c in:cluster ) ';
*/
MainQuery+= OrderByClause ;
if(IsTestMethod)
MainQuery+= ' limit 200' ;
return MainQuery;
}
}
While Ruuning Test, Error is generating ....please Check above code
Error Message: System.NullPointerException: Attempt to de-reference a null object

Stack Trace: Class.DripCampaignSchedulerQueryClass.ConstructExclustionCriteria: line 33, column 28 Class.DripCampaignSchedulerQueryClass.testDripCampaignSchedulerQueryClass: line 264, column 9 External entry point

Code Coverage: 25%

Very thankful if anybody help

 

 

Rakesh

Code:
global void ConstructExclustionCriteria(string ProductName,String City)
{
DripExclusionConditions__c exclustionCriteria=DripExclusionConditions__c.getInstance(ProductName.toLowerCase());
LeadOfferingStatus=exclustionCriteria.Product_Offering_Status__c.split(',');
LeadLastKnownStatus=exclustionCriteria.Last_Known_Status__c.split(',');
LeadValidity=exclustionCriteria.Lead_Validity__c.split(',');
MainStatusCodeF=exclustionCriteria.Main_Status_Code_F__c.split(',');
QualityCheck=exclustionCriteria.Quality_Check__c.split(',');
LeadWrittenOff=true;
CityName=City;
mProductName=ProductName;
exclustionQuery= ' Where Product_Offering_Type__c=:mProductName and IsConverted = false and DP_WriteOff__c !=:LeadWrittenOff and OGL_Positive__c=false and Status not in:LeadOfferingStatus and Lead_Vaildity__c not in:LeadValidity and Last_know_Status__c not in:LeadLastKnownStatus and Main_Status_Code_F__c not in:MainStatusCodeF and Quality_Check__c not in : QualityCheck ';
LeadRefereneExclustionQuery=' Where Lead__r.Product_Offering_Type__c=:mProductName and Lead__r.IsConverted = false and Lead__r.DP_WriteOff__c !=:LeadWrittenOff and Lead__r.OGL_Positive__c=false and Lead__r.Status not in:LeadOfferingStatus and Lead__r.Lead_Vaildity__c not in:LeadValidity and Lead__r.Last_know_Status__c not in:LeadLastKnownStatus and Lead__r.Main_Status_Code_F__c not in:MainStatusCodeF and Lead__r.Quality_Check__c not in : QualityCheck ';
}
public String MonthlySchedulingQuery
{
get
{
strDependentAction.add('Wrong Number');
strDependentAction.add('WN');
//
cluster.add('DNC');
cluster.add('NO NUMBER');
dialerStatusMonthly.add('WN');

MainQuery='Select Id, Name, Lead_City__c, Lead_Cluster__c, Lead_Priority__c, Mailer_Mode__c, MobilePhone, Email, HasOptedOutOfEmail, HasOptedOutOfFax, Product_Offering_Type__c, Non_Connects__c, IsConverted, Exclude_All__c, Loan_Amount1_offer__c, Main_Status_Code__c, Dependent_Action__c, Total_SMS_failed__c, Total_SMS_sent__c,TOTAL_RPC_R__c,Total_Not_interested_Count__c,LeadSource From Lead ';
MainQuery += exclustionQuery;
MainQuery += ' and (IsInDripCampaign__c=0 or IsInDripCampaign__c=null) and Lead_City__c=:CityName ' ;
MainQuery += ' and ( ';
MainQuery += ' Lead_Cluster__c in:cluster ';
MainQuery += ' OR ';
MainQuery +='(( Non_Connects__c > 25 OR (Non_Connects__c > 10 AND Total_SMS_failed__c >= 5) OR (Main_Status_Code__c=:strDispositionStatus or Dialer_Status__c in:dialerStatusMonthly)) AND Last_RPC_date__c=null) ';
MainQuery +=' OR ';
MainQuery+=' Dependent_Action__c in:strDependentAction ';
MainQuery+=' )';
/*
(Lead_Cluster__c in:cluster) OR (Non_Connects__c > 25 or (Non_Connects__c > 10 AND Total_SMS_failed__c >= 5) OR (Main_Status_Code__c=:strDispositionStatus) ) ';


MainQuery+=')'
MainQuery += ' and ((Lead_Cluster__c in:cluster) OR(( Non_Connects__c > 25 or (Non_Connects__c > 10 AND Total_SMS_failed__c >= 5) or (Main_Status_Code__c=:strDispositionStatus or Dialer_Status__c in:dialerStatusMonthly)) and Last_RPC_date__c=null))' ;
MainQuery += ' or Dependent_Action__c in:strDependentAction) ';
//MainQuery += ' and IsInDripCampaign__c=0 and Lead_City__c=:CityName and (Lead_Cluster__c in:cluster ) ';
*/
MainQuery+= OrderByClause ;
if(IsTestMethod)
MainQuery+= ' limit 200' ;
return MainQuery;
}
}
While Ruuning Test, Error is generating ....please Check above code
Error Message: System.NullPointerException: Attempt to de-reference a null object

Stack Trace: Class.DripCampaignSchedulerQueryClass.ConstructExclustionCriteria: line 33, column 28 Class.DripCampaignSchedulerQueryClass.testDripCampaignSchedulerQueryClass: line 264, column 9 External entry point

Code Coverage: 25%

Very thankful if anybody help

 

 

Rakesh