You need to sign in to do that
Don't have an account?

Code coverage
Hello,
I have defined apex trigger code which is working fine but the issue is with code coverage, its showing only 73% while deploying it into the production. Please help
Code snippet:
trigger sendEmail on Case (after insert,after update) {
Public static Boolean InitialEmail =false;
Public static Boolean FinalEmail =false;
//adding for check of trigger behaviour
if(checkRecursive.runOnce())
{
for(Case c:trigger.new) {
system.debug('outside'+c.Send_Email_to_Contact__c);
if ((trigger.isInsert || (trigger.oldMap.get(c.Id).Send_Email_to_Contact__c != c.Send_Email_to_Contact__c)) && (c.Send_Email_to_Contact__c && !c.Do_not_Send_Email__c && c.Email_of_Complainant__c!=null && c.Status!='Completed')) {
system.debug('??????'+c.Send_Email_to_Contact__c);
sendEmailMessage(c.id,c.ownerId,c.Internal_Comments__c,c.Email_of_Complainant__c,c.Site_Details__c,c.CaseNumber,c.Case_Customer_Reference__c );
}
if ((trigger.isInsert || (trigger.oldMap.get(c.Id).Status != c.Status)) && (c.Final_email_to_contact__c && !c.Do_not_Send_Email__c && c.Email_of_Complainant__c!=null && c.Status=='Completed')) {
system.debug('****************'+c.Send_Email_to_Contact__c);
sendFinalEmailMessage(c.id,c.ownerId,c.Internal_Comments__c,c.Email_of_Complainant__c,c.Site_Details__c,c.CaseNumber,c.Case_Customer_Reference__c);
}
}
}
I have defined apex trigger code which is working fine but the issue is with code coverage, its showing only 73% while deploying it into the production. Please help
Code snippet:
trigger sendEmail on Case (after insert,after update) {
Public static Boolean InitialEmail =false;
Public static Boolean FinalEmail =false;
//adding for check of trigger behaviour
if(checkRecursive.runOnce())
{
for(Case c:trigger.new) {
system.debug('outside'+c.Send_Email_to_Contact__c);
if ((trigger.isInsert || (trigger.oldMap.get(c.Id).Send_Email_to_Contact__c != c.Send_Email_to_Contact__c)) && (c.Send_Email_to_Contact__c && !c.Do_not_Send_Email__c && c.Email_of_Complainant__c!=null && c.Status!='Completed')) {
system.debug('??????'+c.Send_Email_to_Contact__c);
sendEmailMessage(c.id,c.ownerId,c.Internal_Comments__c,c.Email_of_Complainant__c,c.Site_Details__c,c.CaseNumber,c.Case_Customer_Reference__c );
}
if ((trigger.isInsert || (trigger.oldMap.get(c.Id).Status != c.Status)) && (c.Final_email_to_contact__c && !c.Do_not_Send_Email__c && c.Email_of_Complainant__c!=null && c.Status=='Completed')) {
system.debug('****************'+c.Send_Email_to_Contact__c);
sendFinalEmailMessage(c.id,c.ownerId,c.Internal_Comments__c,c.Email_of_Complainant__c,c.Site_Details__c,c.CaseNumber,c.Case_Customer_Reference__c);
}
}
}
Apex class checkRecursive() is covered with 1000 % code coverage. issue is while deploying the apex trigger its throwing an error that code coverage is only 73 % while it should be 75 % for deployment in production.
Could anyone help me to get it out.....
In the above triggers, I have one apex class as well checkRecursive() which already covers 100 % code coverage. But still i am unable to deploy the change into salesforce production.
Please help...