• Marty Dorren
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 14
    Replies
Hello,
I'm trying to deploy to production and getting the dreaded "code coverage is 74%, needs to be 75%" error.  No matter what I try, I can't seem to get that 1%.  When I look at some of my lower percentage triggers to tighten them up, I get this analysis from the developer console:
code coverage analysis
My test seems to be blue for the beginning of many of my conditional statements, but not for the subsequent action. (as seen in red).  I been told that if I can get my percentage challenged code to test better and deploy them, that my average code coverage will get better.

I've tried deploying code that I know tested at 100% and it still won't let it deploy.  In Eclipse, I even tried to delete classes that I knew were not needed and it STILL wouldn't let me get through that average code error.  If I could get some idea how to test and cover the above code, I may have a shot.  Any advise would be appreciated.  Thanks,

Marty
I have triggers that reach out to other custom objects subsequently firing their triggers. at the beginning of each trigger for each object, I create a map at the begining of each trigger containing all recordtypes in case needed, which is not usually a problem however, when these triggers start firing one another, I run the risk of reaching my SOQL limit.

The simple solution for me would be to only create the map if it doesn't exist from a previously called trigger.

Is there a way that I can test for the existence of a map before creating it again?

Thanks,
Marty
Hello,
I have a visualforce page with a custom controller.  The custom controller fills in some information in the header of my datatable:

timesheetOwner = [select service_staff__r.name from service_documentation__c where service_staff__c = 'a23M0000001A6FjIAK' limit 1].service_staff__r.name;

In the anon window, the following code also works:

timesheetOwner = [select service_staff__r.name from service_documentation__c where service_staff__c = 'a23M0000001A6FjIAK' limit 1].service_staff__r.name;
system.debug('timesheetowner = '+timesheetowner);

This works fine on my VF page, but when I try to test and deploy to production, I get the "List has no rows for assignment to Sobject" error.  In placing various debug lines in the code, sure enough, the variable shows as null.... however, when I take the SOQL select and place it in the query editor, it works... Very confusing...

Originally, the implicit service_staff__c filter used a variable and gave the same error.  I then tried the select with the literal content and got the same error.

So in a nutshell:
I have a line of code that for all practical purposes... works
The line doesn't work when testing
The code won't deploy for the same reason

Any ideas?

Thanks,
Marty
Hi,
I need to update a field (not required) to null but I'm getting an invalid field error from the debugger when trying to save:

List<monthly_summary__c> MSUp = [Select Id, Billing__c from monthly_summary__c where Id IN : ListMSDelId];

                for(monthly_summary__c MSUp2 : MSUp) {
                    MSUp2.setFieldsToNull = new string[] { 'billing__c' };
//                    MSUp2.Billing__c = null;
                }
update MSUp;

Any suggestions?  I coundn't find much in the way of sample code to do this.
Thanks
As of 3 days ago, our email2case functionality returns the following error:

"A22 NO Some of the requested messages no longer exist.;
  nested exception is:
com.sun.mail.iap.CommandFailedException: A22 NO Some of the requested messages no longer exist."

This has worked well for us for literally years.  Any suggestions as to how to troubleshoot this would be appreciated.
Thanks,
Marty
Hi,
I'll apologize ahead of time...

I have some class code that inserts records to a custom object and works fine in anonymouse as long as I comment out the class and method lines at the top.  I have to put this class in a schedule and the schedule runs but the class does NOT execute.  I fear I'm missing something very basic, but at this point, I'm in quicksand.  Here's the code... very simple:

public class Daily_SD_Insert_SVIRA {
    public static void DoSDInsert() {

        date tdy = system.date.today();
        date SvcDate = system.date.today();
        date FirstofLast = date.valueOf(system.date.newInstance(system.today().year(),system.today().month()-1,01));
        date LastofLast = FirstofLast.addMonths(1).toStartofMonth().addDays(-1);
        string IPRecType = '012Z00000004nSCIAY';
        string SDRecType = '012Z00000004nS7IAI';
        string MSRecType = '012F0000000muqTIAQ';
//SD Inserts
        //Create SD Lists
        List<Individual_Programs__c> IPRGSD1 = [select Id, service__c from individual_programs__c where (
        (Status__c = 'Enrolled' and enroll_date__c < today )
        and RecordTypeId = :IPRecType and
            Id NOT IN (Select Individual_Program__c from service_documentation__c where
                       service_date__c = :SvcDate and RecordTypeID = :SDRecType))];
          
        system.debug('IPRGSD1 = '+IPRGSD1);
        List<service_documentation__c> sda = new List<service_documentation__c>();
        //Insert SD
        INTEGER ipcnt = 0;
        for (Individual_Programs__c IPRGSD : IPRGSD1) {
                                    sda.add (new service_documentation__c(
                                    service_Date__c = SvcDate,       
                                    Billable_hours__c = 0,
                                    Billable_minutes__c = 0,
                                    RecordTypeId = SDRecType,
                                    service__c = IPRGSD.service__c,
                                    Individual_Program__c = IPRGSD.Id));
                                system.debug('IPRGSD-Individual_Program__c = '+IPRGSD.Id+ ' |count:'+ipcnt);
                                ipcnt = ipcnt+1;
                            }
                    Database.insert(sda);
                    }
                    }

Thanks ahead of time...

Marty
I have triggers that reach out to other custom objects subsequently firing their triggers. at the beginning of each trigger for each object, I create a map at the begining of each trigger containing all recordtypes in case needed, which is not usually a problem however, when these triggers start firing one another, I run the risk of reaching my SOQL limit.

The simple solution for me would be to only create the map if it doesn't exist from a previously called trigger.

Is there a way that I can test for the existence of a map before creating it again?

Thanks,
Marty
Hello,
I have a visualforce page with a custom controller.  The custom controller fills in some information in the header of my datatable:

timesheetOwner = [select service_staff__r.name from service_documentation__c where service_staff__c = 'a23M0000001A6FjIAK' limit 1].service_staff__r.name;

In the anon window, the following code also works:

timesheetOwner = [select service_staff__r.name from service_documentation__c where service_staff__c = 'a23M0000001A6FjIAK' limit 1].service_staff__r.name;
system.debug('timesheetowner = '+timesheetowner);

This works fine on my VF page, but when I try to test and deploy to production, I get the "List has no rows for assignment to Sobject" error.  In placing various debug lines in the code, sure enough, the variable shows as null.... however, when I take the SOQL select and place it in the query editor, it works... Very confusing...

Originally, the implicit service_staff__c filter used a variable and gave the same error.  I then tried the select with the literal content and got the same error.

So in a nutshell:
I have a line of code that for all practical purposes... works
The line doesn't work when testing
The code won't deploy for the same reason

Any ideas?

Thanks,
Marty
Hi,
I need to update a field (not required) to null but I'm getting an invalid field error from the debugger when trying to save:

List<monthly_summary__c> MSUp = [Select Id, Billing__c from monthly_summary__c where Id IN : ListMSDelId];

                for(monthly_summary__c MSUp2 : MSUp) {
                    MSUp2.setFieldsToNull = new string[] { 'billing__c' };
//                    MSUp2.Billing__c = null;
                }
update MSUp;

Any suggestions?  I coundn't find much in the way of sample code to do this.
Thanks
As of 3 days ago, our email2case functionality returns the following error:

"A22 NO Some of the requested messages no longer exist.;
  nested exception is:
com.sun.mail.iap.CommandFailedException: A22 NO Some of the requested messages no longer exist."

This has worked well for us for literally years.  Any suggestions as to how to troubleshoot this would be appreciated.
Thanks,
Marty
Hi,
I'll apologize ahead of time...

I have some class code that inserts records to a custom object and works fine in anonymouse as long as I comment out the class and method lines at the top.  I have to put this class in a schedule and the schedule runs but the class does NOT execute.  I fear I'm missing something very basic, but at this point, I'm in quicksand.  Here's the code... very simple:

public class Daily_SD_Insert_SVIRA {
    public static void DoSDInsert() {

        date tdy = system.date.today();
        date SvcDate = system.date.today();
        date FirstofLast = date.valueOf(system.date.newInstance(system.today().year(),system.today().month()-1,01));
        date LastofLast = FirstofLast.addMonths(1).toStartofMonth().addDays(-1);
        string IPRecType = '012Z00000004nSCIAY';
        string SDRecType = '012Z00000004nS7IAI';
        string MSRecType = '012F0000000muqTIAQ';
//SD Inserts
        //Create SD Lists
        List<Individual_Programs__c> IPRGSD1 = [select Id, service__c from individual_programs__c where (
        (Status__c = 'Enrolled' and enroll_date__c < today )
        and RecordTypeId = :IPRecType and
            Id NOT IN (Select Individual_Program__c from service_documentation__c where
                       service_date__c = :SvcDate and RecordTypeID = :SDRecType))];
          
        system.debug('IPRGSD1 = '+IPRGSD1);
        List<service_documentation__c> sda = new List<service_documentation__c>();
        //Insert SD
        INTEGER ipcnt = 0;
        for (Individual_Programs__c IPRGSD : IPRGSD1) {
                                    sda.add (new service_documentation__c(
                                    service_Date__c = SvcDate,       
                                    Billable_hours__c = 0,
                                    Billable_minutes__c = 0,
                                    RecordTypeId = SDRecType,
                                    service__c = IPRGSD.service__c,
                                    Individual_Program__c = IPRGSD.Id));
                                system.debug('IPRGSD-Individual_Program__c = '+IPRGSD.Id+ ' |count:'+ipcnt);
                                ipcnt = ipcnt+1;
                            }
                    Database.insert(sda);
                    }
                    }

Thanks ahead of time...

Marty