0

I added a piece of code into the existing one:

Set<id> affIdSet = new Set<id>();
        for (npe5__Affiliation__c a : aUpdates) {
            affIdSet.add(a.id);
        }
        List<npe5__Affiliation__c> aTrackPortalInfo = new List<npe5__Affiliation__c>();
        /*aTrackPortalInfo = [select id, Lodge_Name__c, Lodge_No__c, npe5__Contact__c, npe5__StartDate__c, Lodge_Masonic_Status__c
                            from npe5__Affiliation__c 
                            where id in :affIdSet];*/
        aTrackPortalInfo = [select id, Lodge_Name__c
                            from npe5__Affiliation__c 
                            where id in :affIdSet];
        for(npe5__Affiliation__c a : aTrackPortalInfo){
            apList.add(new Affiliations_Portal__c(AffiliationId__c = a.id, Lodge__c = a.Lodge_Name__c, Lodge_Number__c = String.valueOf(a.Lodge_No__c), Member__c = a.npe5__Contact__c, Start_Date__c = a.npe5__StartDate__c, Status__c = a.Lodge_Masonic_Status__c  ));
        }

        System.debug('affIdSet is ' + affIdSet);
        System.debug('aTrackPortalInfo is ' + aTrackPortalInfo);
        System.debug('apList is ' + apList);

The interesting part is: when I use this code, when processing, it will cause the exception which will show in the VF page. But, when I fix it - using the code in the comment, it doesn't seem to step into this piece of code. I tracked the debug log in developer console and couldn't find anything which should be written in by System.debug.

Actually, I put a system.debug into the first line of the code section and still doesn't see it step into that one.

This code file is a 1600 line monster so I am not gonna paste it here. Any thoughts why this is not exercised? It's a bit strange to me - since when I had the exception, it seems to be exercised well.

  • If the generated log is too big, then part of the log got skipped and does not show in debug log. So, that might be the reason your system.debug not appear there. Check your debug log for the word "skipped". – Bforce May 29 '14 at 4:30
  • That will probably be the reason. Any thoughts on how can I debug on this? – Lance Shi May 29 '14 at 4:41
  • 1
    just comment out some of system.debug statements in for loops prior to the code you are trying to debug in order to avoid the logs that would get generated. – Bforce May 29 '14 at 4:59
  • What is the exception you are getting? – Eric Oct 31 '14 at 0:22
0

Are you sure you're running it with the exact same setup? Since all you're changing is the fields queried I don't think that's going to cause a problem. Seems more likely that affIdSet is different, and/or you've changed some other code as well.

When checking for results of the query in the logs the easiest bet is to search for the query itself.

| improve this answer | |
  • I would say it is exactly the same. Actually, I just used the uncommented section to test how it goes. It seems to me that the code is still executed. But the log is not there. – Lance Shi May 29 '14 at 4:47
0

if there are other debug statements in your code, you might want to take those out, and adjust the log filters so you remove extraneous entries. then, try adding debug statements within the loops to see if you get any feedback there?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.