You need to sign in to do that
Don't have an account?
Srinivas C
Hi iam unable to cover the test coverage for this lines of code please help
newEngagement = new Projects__c(Account__c = opp.Account_Name__c, Opportunityc__c = opp.Id, Name = opp.Name + ' - ' + System.today().format(),Project_Manager__c=opp.Project_Manager_list__c,End_Date__c=opp.End_Date__c);
list<Projects__c> upEngagement=[select id,name from Projects__c where id in: templateIds];
newEngagement.Estimated_Project_Revenue__c = totalAmount;
for(Projects_ESR__c templist:upEngagement)
{
system.debug('templateIds'+templatename);
templatename+=templist.Name+',';
}
templatename=templatename.removeEnd(',');
newEngagement.Template_Project__c=templatename;
salesres=[select id,name,Sales_Responsible_Name__c,Email from user where Sales_Responsible_Name__c!=null and Sales_Responsible_Name__c=:newEngagement.Project_Manager__c];//'Anthony Kent'];//opp.Sales_Responsible__c];// id=:sales];
if(salesres.size()>0){
newEngagement.Sales_responsible_email__c=salesres[0].email;
}
newEngagement.Total_Sales_Price__c=opp.Total_Sales_Price__c;
newEngagement.Labour_Cost__c=opp.Labour_Cost__c;
newEngagement.External_Cost__c=opp.External_Cost__c;
newEngagement.Contingency_Cost__c=opp.Contingency_Cost__c;
insert newEngagement;
PageReference pr = new PageReference('/' + newEngagement.Id);
pr.setRedirect(true);
return pr;
}
Regards,
Srinivas C
list<Projects__c> upEngagement=[select id,name from Projects__c where id in: templateIds];
newEngagement.Estimated_Project_Revenue__c = totalAmount;
for(Projects_ESR__c templist:upEngagement)
{
system.debug('templateIds'+templatename);
templatename+=templist.Name+',';
}
templatename=templatename.removeEnd(',');
newEngagement.Template_Project__c=templatename;
salesres=[select id,name,Sales_Responsible_Name__c,Email from user where Sales_Responsible_Name__c!=null and Sales_Responsible_Name__c=:newEngagement.Project_Manager__c];//'Anthony Kent'];//opp.Sales_Responsible__c];// id=:sales];
if(salesres.size()>0){
newEngagement.Sales_responsible_email__c=salesres[0].email;
}
newEngagement.Total_Sales_Price__c=opp.Total_Sales_Price__c;
newEngagement.Labour_Cost__c=opp.Labour_Cost__c;
newEngagement.External_Cost__c=opp.External_Cost__c;
newEngagement.Contingency_Cost__c=opp.Contingency_Cost__c;
insert newEngagement;
PageReference pr = new PageReference('/' + newEngagement.Id);
pr.setRedirect(true);
return pr;
}
Regards,
Srinivas C
Hi Srinivas,
Please Find The Solution.
Test Class
Apex class-I think need some changes in your apex
If you find it is helpful please mark best answer.
Thanks