function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BellaBella 

External Entry Point Error

Hi, this is related to my earlier post here

I have a fairly large test method that gives me 90% test coverage in sandbox with no problems, but then when I try to migrate it to production, I’m suddenly getting an external entry point error on the last line. I talked to my co-worker and she says it’s because there is some inconsistency between sandbox and production, but I can’t seem to figure out how to fix it. I checked all the validation rules and things like that and can’t find any inconsistencies.

Has anyone come across this before? When something works well in sandbox but then you have this sort of trouble getting it into production?
Best Answer chosen by Admin (Salesforce Developers) 
BellaBella

Ok problem solved. It was an issue of me not filtering out the inactive products. So much trouble for one little line. The interesting part was the actual debugging process. Since I was running out of room in the debug log that came up when I tried to import it, I figured I could run the code in production for a specific contract through the system log. That's where I saw that I was collecting too many products and when it came to using them to look for pricebook entries, the whole thing fell appart because it was looking for inactive products. Just an idea, but if anyone else runs into this sort of problem, you can try debugging through production's system log ^_^

All Answers

WesNolte__cWesNolte__c

Hey

 

Yes, it happens quite often. Can you post the piece of code causing the problem, and if you have anymore of the error could you post that too please?

 

Wes 

BellaBella

According to the log, it's the last line test.stopTest(); that causes it though it's not very specific. Part of what frustrates me is that it doesn't give me too much information. The idea of the class is that I need to create opportunities from contracts whose end date is 90 days from now.

Message Edited by Bella on 04-01-2010 11:46 AM
WesNolte__cWesNolte__c

Hey

 

Looks okay, I'm thinking it some peculiarity that Salesforce hasn't dealt with properly. Could you move the test method into it's own test class, so that the class containing the schedule code is completely seperate from the class containing it's test code. Just a shot in the dark really..

 

Wes 

BellaBella
Hey, yeah I tried that but it didn't really help. Actually I prefer to have it in a test method within the class if at all possible because then I can run the test in production and not just through eclipse. Thanks for trying. If anyone has any other thoughts please let me know :(
CaptainObviousCaptainObvious

If all else fails (and if you have a sandbox to spare) refresh an existing sandbox to make sure you have the most current configuration- and do your testing there.

 

I usually leave plenty of debug statements in production, so if a problem does arise, it's easier to pinpoint the  error.

 

By the way, you can still run tests in production when you separate the test method.

 

BellaBella

Ok problem solved. It was an issue of me not filtering out the inactive products. So much trouble for one little line. The interesting part was the actual debugging process. Since I was running out of room in the debug log that came up when I tried to import it, I figured I could run the code in production for a specific contract through the system log. That's where I saw that I was collecting too many products and when it came to using them to look for pricebook entries, the whole thing fell appart because it was looking for inactive products. Just an idea, but if anyone else runs into this sort of problem, you can try debugging through production's system log ^_^

This was selected as the best answer
SsuazoSsuazo

Can anybody give me a clear explanation on the exact meaning of an External Entry Point Error and what causes it? Also, if possible how to fix it as well. Any insight will help .... Thanks in adavance

SsuazoSsuazo
 

So i executed the code below and im gettin an external entry point error and i have no clue why. Can anyone help, Thanks

 

public class AccountDuplicateTriggerTests{
    static testMethod void AccountDuplicateTrigger() {
       
      // First make sure there are no leads already in the system 
   
      // that have the email addresses used for testing 
     
    
     
      Set<String> testBillingPostalCode = new Set<String>();
      testBillingPostalCode.add('10456');
      testBillingPostalCode.add('20457');
      testBillingPostalCode.add('30458');
      testBillingPostalCode.add('40459');
      testBillingPostalCode.add('50451');

      Set<String> testBillingCity = new Set<String>();
      testBillingCity.add('Bronx');
      testBillingCity.add('Queens');
      testBillingCity.add('Manhattan');
      testBillingCity.add('Staten Island');
      testBillingCity.add('Long Island');
     
      Set<String> testBillingStreet = new Set<String>();
      testBillingStreet.add('1 Franklin Ave');
      testBillingStreet.add('2 Franklin Ave');
      testBillingStreet.add('3 Franklin Ave');
      testBillingStreet.add('4 Franklin Ave');
      testBillingStreet.add('5 Franklin Ave');
     
      Set<String> testBillingState = new Set<String>();
      testBillingState.add('NY');
      testBillingState.add('PA');
      testBillingState.add('MD');
      testBillingState.add('NV');
      testBillingState.add('AZ');

     
      System.assert([SELECT count() FROM Account
                     WHERE BillingStreet IN :testBillingStreet AND BillingCity IN :testBillingCity AND
                     BillingState IN :testBillingState AND BillingPostalCode IN :testBillingPostalCode] == 0);
       
      // Seed the database with some leads, and make sure they can 
   
      // be bulk inserted successfully. 
   
      Account account1 = new Account(Name='Test1', BillingStreet='1 Franklin Ave', BillingCity='Bronx', BillingState='NY',
      BillingPostalCode='10456');
      Account account2 = new Account(Name='Test2', BillingStreet='2 Franklin Ave', BillingCity='Queens', BillingState='PA',
      BillingPostalCode='20457');
      Account account3 = new Account(Name='Test3', BillingStreet='3 Franklin Ave', BillingCity='Manhattan', BillingState='MD',
      BillingPostalCode='30458');
      Account[] accounts = new Account[] {account1, account2, account3};
      insert accounts;
       
      // Now make sure that some of these leads can be changed and 
   
      // then bulk updated successfully. Note that lead1 is not 
   
      // being changed, but is still being passed to the update 
   
      // call. This should be OK. 
   
      account2.BillingStreet = '2 Franklin Ave';
      account3.BillingStreet = '3 Franklin Ave';  
     
      account2.BillingCity = 'Queens';
      account3.BillingCity = 'Manhattan';
     
      account2.BillingState = 'PA';
      account3.BillingState = 'MD';
     
      account2.BillingPostalCode='20457';
      account3.BillingPostalCode='30458';
     
      update accounts;
       
      // Make sure that single row lead duplication prevention works 
   
      // on insert. 
   
      Account dup1 = new Account(Name='Test1Dup',
                           BillingStreet = '2 Franklin Ave', BillingCity = 'Queens', BillingState = 'PA',
                           BillingPostalCode='20457' );                        
            // Make sure that single row lead duplication prevention works 
   
      // on update. 
     
         try {
         insert dup1;
         System.assert(false);
      } catch (DmlException e) {
         System.assert(e.getNumDml() == 1);
         System.assert(e.getDmlIndex(0) == 0);
         System.assert(e.getDmlFields(0).size() == 1);
         System.assert(e.getDmlMessage(0).indexOf(
            'A lead with this email address already exists.') > -1);
      }

   
      dup1 = new Account(Id = account1.Id, Name='Test1Dup',
                      BillingStreet='1 Franklin Ave', BillingCity = 'Bronx', BillingState = 'NY',
                      BillingPostalCode='10456');
                     
     try {
         update dup1;
         System.assert(false);
      } catch (DmlException e) {
         System.assert(e.getNumDml() == 1);
         System.assert(e.getDmlIndex(0) == 0);
         System.assert(e.getDmlFields(0).size() == 1);
         System.assert(e.getDmlMessage(0).indexOf(
            'A lead with this email address already exists.') > -1);
        }

                     
                    
                  
        
      // Make sure that bulk lead duplication prevention works on 
   
      // insert. Note that the first item being inserted is fine, 
   
      // but the second and third items are duplicates. Note also 
   
      // that since at least one record insert fails, the entire 
   
      // transaction will be rolled back. 
   
      dup1 = new Account(Name='Test1Dup', BillingStreet='1 Franklin Ave', BillingCity = 'Bronx', BillingState = 'NY');
                    
      Account dup2 = new Account(Name='Test2Dup',
                           BillingStreet = '2 Franklin Ave', BillingCity = 'Queens', BillingState = 'PA',
                           BillingPostalCode='20457');
      Account dup3 = new Account(Name='Test3Dup',
                           BillingStreet = '3 Franklin Ave', BillingCity = 'Manhattan', BillingState = 'MD',
                           BillingPostalCode='30458');     
                           Account[] dups = new Account[] {dup1, dup2, dup3};
                          
                      
 
   
      // Make sure that bulk lead duplication prevention works on 
   
      // update. Note that the first item being updated is fine, 
   
      // because the email address is new, and the second item is 
   
      // also fine, but in this case it's because the email 
   
      // address doesn't change. The third case is flagged as an 
   
      // error because it is a duplicate of the email address of the 
   
      // first lead's value in the database, even though that value 
   
      // is changing in this same update call. It would be an 
   
      // interesting exercise to rewrite the trigger to allow this 
   
      // case. Note also that since at least one record update 
   
      // fails, the entire transaction will be rolled back. 
   
      dup1 = new Account(Id=account1.Id, BillingStreet = '4 Franklin Ave', BillingCity = 'Staten Island', BillingState = 'NV',
      BillingPostalCode='40459');
      dup2 = new Account(Id=account2.Id, BillingStreet = '2 Franklin Ave', BillingCity = 'Queens',BillingState = 'PA',
      BillingPostalCode='20457');
      dup3 = new Account(Id=account3.Id, BillingStreet = '3 Franklin Ave', BillingCity = 'Manhattan',BillingState = 'MD',
      BillingPostalCode='30458');

      dups = new Account[] {dup1, dup2, dup3};
            
 

      // Make sure that duplicates in the submission are caught when 
   
      // inserting leads. Note that this test also catches an 
   
      // attempt to insert a lead where there is an existing 
   
      // duplicate. 
   
      dup1 = new Account(Id=account1.Id, BillingStreet = '4 Franklin Ave', BillingCity = 'Staten Island', BillingState = 'NV',
      BillingPostalCode='40459');
      dup2 = new Account(Id=account2.Id, BillingStreet = '3 Franklin Ave', BillingCity = 'Manhattan', BillingState = 'MD',
      BillingPostalCode='30458');
      dup3 = new Account(Id=account3.Id, BillingStreet = '3 Franklin Ave', BillingCity = 'Manhattan', BillingState = 'MD',
      BillingPostalCode='30458');
            dups = new Account[] {dup1, dup2, dup3};
             
      // Make sure that duplicates in the submission are caught when 
   
      // updating leads. Note that this test also catches an attempt 
   
      // to update a lead where there is an existing duplicate. 
   
      dup1 = new Account(Id=account1.Id, BillingStreet = '4 Franklin Ave', BillingCity = 'Staten Island', BillingState = 'NV', BillingPostalCode='40459');
      dup2 = new Account(Id=account2.Id, BillingStreet = '4 Franklin Ave', BillingCity = 'Staten Island', BillingState = 'NV', BillingPostalCode='40459');
      dup3 = new Account(Id=account3.Id, BillingStreet = '2 Franklin Ave', BillingCity = 'Queens', BillingState = 'PA', BillingPostalCode='20457');
      dups = new Account[] {dup1, dup2, dup3};
         }
}

K_devK_dev

Developer script exception from Exelon Energy : CreditAppExtension : Attempt to de-reference a null object

 

Apex script unhandled exception by user/organization: 00570000000sRHO/00D700000008WI2

 

Visualforce Page: /apex/CreditAppExtension

 

 

 

caused by: System.NullPointerException: Attempt to de-reference a null object

 

Class.CreditAppExtension.save: line 290, column 16

External entry point

 

 

 

Please help me for  solving this error!!

Pranav ChitransPranav Chitrans
Hi Ssuazo,

You need to go though the article of salesforce aggregate function. Actually what i understand by seeing your code, you are using the aggregate function SUM() COUNT() in your for loop SOQL query which will give error.

You need to do soemthing like this 
for (***variableORLisr*** : [soql_query]) {
    your_code_block
}

 
Vidya RaniVidya Rani
I am trying to use multiselect picklist on vf page and show results based on selected values via button click. Getting Error :
" Visualforce Error
System.NullPointerException: Attempt to de-reference a null object 
External entry point "

Any suggestions will really help. Thanks in advance.

Code Piece:
<apex:page controller="SinglepicklistforMyBook" action="{!autoRun}" sidebar="false">

    <apex:form >
     <table align="center" cellpadding="15" > 
    <td>Select Property Type :-</td>
         <td><apex:selectList size="4" value="{!SelectValue}" multiselect="true">
            <apex:selectOptions value="{!statusOptions}"/>       

        </apex:selectList></td>        
       <tr> <td>List of Selected Values For Books of Type:</td> 
  <td><apex:outputText label="You have selected:" value="{!SelectValue}" /> </td> </tr>
          <div align="center" draggable="false" > 
            <apex:commandButton style="float:centre" value="Show Result" onclick="{!ShowResult}"/>
            <apex:actionSupport reRender="refresh" event="onkeyup" />
            </div>
                 <apex:pageBlock >
   <apex:pageblockTable align="center" cellpadding="15" value="{!ShowResult}" var="O" title="List of Selected Books">
       <apex:column value="{!O.Name}"/>
       <apex:column value="{!O.Status_Book__c}"/>
       </apex:pageblockTable> 
  </apex:pageBlock>   
        </table>
    </apex:form>
</apex:page>
*************************
Controller
*************************
public with sharing class SinglepicklistforMyBook {

public List<SelectOption> statusOptions { get;set; }
public List<String> selectValue {get;set;} //for multiselect
     
    //    public string selectValue { get;set; }  //in case multiselect =false
 List<Book__c> showresult;
    public List<Book__c> getShowResult() {
 
      //showresult=  [Select Name, Status_Book__c from Book__c where Status_Book__c = :selectValue ]; // for multiselect = false
        showresult=  [Select Name, Status_Book__c from Book__c where Status_Book__c IN :selectValue]; //for multiselect
        return showresult;
    }

public void autoRun()

{

    Schema.DescribeFieldResult statusFieldDescription = Book__c.Status_Book__c.getDescribe();

    statusOptions = new list<SelectOption>();     

    for (Schema.Picklistentry picklistEntry : statusFieldDescription.getPicklistValues())

    {

        statusOptions.add(new SelectOption(pickListEntry.getValue(),pickListEntry.getLabel()));

    }

}

}
KdKomalKdKomal
Hi Vidya 
Please try the below code and let me know if it helps

VF
<apex:page controller="SinglepicklistforMyBook" sidebar="false">

    <apex:form >
     <table align="center" cellpadding="15" > 
        <td>Select Property Type :-</td>
        <td>
            <apex:selectList size="4" value="{!SelectValue}" multiselect="true">
                <apex:selectOptions value="{!statusOptions}"/>       
            </apex:selectList></td>        
       <tr> <td>List of Selected Values For Books of Type:</td> 
          <td><apex:outputText label="You have selected:" value="{!SelectValue}" /> </td> </tr>
          <div align="center" draggable="false" > 
            <apex:commandButton style="float:centre" value="Show Result" onclick="{!ShowResult}"/>
            <apex:actionSupport reRender="refresh" event="onkeyup" />
             <!-- <apex:commandButton style="float:centre" value="Show Result 2" action="{!getData}" reRender="refresh"/> -->
            
            </div>
            <!-- Add  id="refresh"  if you are using pagerefernce approach-->
                 <apex:pageBlock >
                   <apex:pageblockTable align="center" cellpadding="15" value="{!ShowResult}" var="O" title="List of Selected Books">
                       <apex:column value="{!O.Name}"/>
                       <apex:column value="{!O.Status_Book__c}"/>
                   </apex:pageblockTable> 
                </apex:pageBlock>   
        </table>
    </apex:form>
</apex:page>

Controller
public with sharing class SinglepicklistforMyBook {

public List<SelectOption> statusOptions { get;set; }
public List<String> selectValue {get;set;} //for multiselect

public SinglepicklistforMyBook(){
        statusOptions = new List<SelectOption>();
        Schema.DescribeFieldResult statusFieldDescription = Book__c.Status_Book__c .getDescribe();
        for (Schema.PicklistEntry ple : statusFieldDescription.getPicklistValues()){
            statusOptions.add(new SelectOption(ple.getValue(),ple.getLabel()));
         }
    }
     
    //    public string selectValue { get;set; }  //in case multiselect =false
 public List<Book__c> showresult;
    public List<Book__c> getShowResult() {
 
if(selectValue != null){
            //showresult=  [Select Name, Status_Book__c from Book__c where Status_Book__c = :selectValue ]; // for multiselect = false
        showresult=  [Select Name, Status_Book__c from Book__c where Status_Book__c IN :selectValue]; //for multiselect   
        }
        else{
            return null;
        }
      
        return showresult;
    }

/*
 Code used when command button action attribute is used.
    public PageReference getData(){
        if(selectValue != null){
            showresult=  [Select Name,Status_A_Z__c  from Agency__c where Status_A_Z__c IN :selectValue]; //for multiselect   
        }
        else{
            return null;
        }
        //showresult=  [Select Name, Status_Book__c from Book__c where Status_Book__c = :selectValue ]; // for multiselect = false
        return null;
        
    }
*/

}

Just a Quick Suggestion, every time the button is clicked the page will be refreshed. If you do it with the command button action attribute and Refresh Asynchronously only a section of a page, hence improving the User exp. and it will not it the server multiple times. I have added some commented Code, please go through it and if any doubt comes up please let me know.
Vidya RaniVidya Rani
It was done already. Thanks for responding Kd