+ Start a Discussion
Dominic SebastianDominic Sebastian 

Non-void method might not return a value or might have statement after a return statement.

public String isNationwideProvider {get; set;}

public PageReference BankReference(){
          List<Account> lstSite1 = [SELECT Id, NationwideProvider__c FROM Account WHERE Id =:this.pathI];
     if(isNationwideProvider.equals('Yes')){ //ERROR IS HERE
            return gotoBankReference();
         //System.debug('error');
        }
        else if(isNationwideProvider.equals('No')){ //ERROR IS HERE
                 if (lstSite1.size() > 0){        

                return gotoBankReference();
                     }
              else{
                 ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Must upload a document');
                  ApexPages.addMessage(myMsg);
                System.debug('*** currentFile.Name.substringAfterLast ***'+ myMsg);
                 return null;
                }
                
             }
I get the following error Non-void method might not return a value or might have statement after a return statement. on the "//ERROR IS HERE"
please help me to solve this. Thanks.
Dushyant SonwarDushyant Sonwar
Hi Dominic,
Use Return null at end of your BankReference() Function...