You need to sign in to do that
Don't have an account?
Raju kanoperi
Hi buddies.. I want test class for This trigger pls help me on this urgent... Thanks..
trigger DealProfitCenterUpdate on Quote_Option__c (after insert,after update) {
List<Quote_Option__c> QpList = new List<Quote_Option__c>();
Set<String> RetridSet = new Set<String>();
Map<String,String> ProfitcenterMap = new Map<String,String>();
List<Opportunity> OppList = new List<Opportunity>();
for(Quote_Option__c Qoop: Trigger.new){
RetridSet.add(Qoop.ReiTreatyId__c);
QpList.add(Qoop);
}
List<DY_Profit_Center__c> Dy = new List<DY_Profit_Center__c>([SELECT id,ReiTreatyId__c,DY_Profit_Center__c,DY_Profit_Center_Description__c FROM DY_Profit_Center__c WHERE ReiTreatyId__c IN:RetridSet]);
for(DY_Profit_Center__c aProfitcenter:Dy){
ProfitcenterMap.put(aProfitcenter.ReiTreatyId__c,aProfitcenter.DY_Profit_Center__c);
}
for(Quote_Option__c aQuoteOption:QpList){
if(ProfitcenterMap.ContainsKey(aQuoteOption.ReiTreatyId__c)){
if(aQuoteOption.StopLoss_Deal__c !=NULL){
Opportunity Opp=new Opportunity(Id = aQuoteOption.StopLoss_Deal__c);
Opp.PCL_5__C = ProfitcenterMap.get(aQuoteOption.ReiTreatyId__c);
OppList.add(opp);
}
}
}
if(OppList.size()>0){
Database.update(OppList,False);
}
}
List<Quote_Option__c> QpList = new List<Quote_Option__c>();
Set<String> RetridSet = new Set<String>();
Map<String,String> ProfitcenterMap = new Map<String,String>();
List<Opportunity> OppList = new List<Opportunity>();
for(Quote_Option__c Qoop: Trigger.new){
RetridSet.add(Qoop.ReiTreatyId__c);
QpList.add(Qoop);
}
List<DY_Profit_Center__c> Dy = new List<DY_Profit_Center__c>([SELECT id,ReiTreatyId__c,DY_Profit_Center__c,DY_Profit_Center_Description__c FROM DY_Profit_Center__c WHERE ReiTreatyId__c IN:RetridSet]);
for(DY_Profit_Center__c aProfitcenter:Dy){
ProfitcenterMap.put(aProfitcenter.ReiTreatyId__c,aProfitcenter.DY_Profit_Center__c);
}
for(Quote_Option__c aQuoteOption:QpList){
if(ProfitcenterMap.ContainsKey(aQuoteOption.ReiTreatyId__c)){
if(aQuoteOption.StopLoss_Deal__c !=NULL){
Opportunity Opp=new Opportunity(Id = aQuoteOption.StopLoss_Deal__c);
Opp.PCL_5__C = ProfitcenterMap.get(aQuoteOption.ReiTreatyId__c);
OppList.add(opp);
}
}
}
if(OppList.size()>0){
Database.update(OppList,False);
}
}
Raju,
Could you please provide me the object fields Name, Object Name on my email Id? It could be best to create test class accordingly.
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com