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
bappabappa 

ApexPagesHandledException on Opportunity list view

Hi,

I am getting 'core.apexpages.exceptions.ApexPagesHandledException: Object type not accessible. Please check permissions and make sure the object is not in development mode: Opportunity WHERE ( ((Fiscal = Q3)) ) ORDER BY Name ASC LIMIT ^ ERROR at Row:1:Column:306 Bind variables only allowed in Apex code ' exception when I used StandardSetController. I have not used any SOQL query still getting this error, getting this error only for one list view (Q3 opps where Fiscal period is Q3), but for the other list views its working great.Please suggest how to resolve this error. Below is my class:
public with sharing class OppRecordSetVarController {  
    
    private final Integer pageSize = 10;
    public integer pageNumber = 1; 
    public boolean lastPage = false;
    private final String Could_Not_Save_Modified_Records = 'You have changed some values of the below records but did not save, please review the changes and "Save" the records then proceed.Otherwise “Cancel” to discard all pending changes.'; 
    public transient Map<String, Decimal> probabilityStageNameMap;   
    ApexPages.StandardSetController controller;
    public List<Opportunity> oppList{get;set;}
    PageReference pg;
   
    
    public OppRecordSetVarController(ApexPages.StandardSetController controller) {  
        try{
        this.controller = controller;
        controller.setPageSize(pageSize);
        oppList = new List<Opportunity>(); 
        Id id = controller.getFilterId(); 
        controller.setFilterId(Id); 
        }catch(Exception e){
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'Sorry this list view is not Accessible from this page, Please select All Opportunities from Standard Opportunity view and the try reloading this page'));    
        }    
    } 
    
    public void doNext(){        
        try{
            controller.Next();
            pageNumber++;
            lastPage = false;
        }catch(Exception e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.WARNING,Could_Not_Save_Modified_Records));
        }
    }
     
    public void doPrevious(){        
        try{
            controller.Previous();
            pageNumber--;
            lastPage = false;
        }catch(Exception e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.WARNING,Could_Not_Save_Modified_Records));
        }
    }
        
    public void doFirst(){        
        try{
            controller.First();
            pageNumber = 1;
            lastPage = false;
        }catch(Exception e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.WARNING,Could_Not_Save_Modified_Records));
        }
    }
        
    public void doLast(){        
        try{
            controller.Last();
            lastPage = true; 
            pageNumber++;
            
        }catch(Exception e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.WARNING,Could_Not_Save_Modified_Records));
        }
    }
         
    public Boolean getHasPrevious(){             
        return this.controller.getHasPrevious(); 
    }
      
    public Boolean getHasNext(){         
        return this.controller.getHasNext();    
    } 
       
    public List<Opportunity> getOpportunities() {        
        oppList = (List<Opportunity>) controller.getRecords();
        System.debug('==oppList.size=='+oppList.size()); 
        return (List<Opportunity>) controller.getRecords();
    }
    
    public PageReference changeStageName(){        
    if (probabilityStageNameMap == null) {
        probabilityStageNameMap = new Map<String, Decimal>();
        for (OpportunityStage oppStage : [Select MasterLabel, DefaultProbability
                                       From OpportunityStage]) {
           probabilityStageNameMap.put(oppStage.MasterLabel, oppStage.DefaultProbability);
        }
    }
  
    for(Opportunity op : oppList){   
    if (probabilityStageNameMap.containsKey(op.StageName)) {         
         op.Probability = probabilityStageNameMap.get(op.StageName);         
    }
    }
    return null;    
    }
    
    public void changeListView(){       
        //controller.save();                   
    }
 
    public PageReference doSave(){   
    
    PageReference p;  
    try{
    p =  this.controller.save();
    
    if(p != null){
        //if(pageNumber != 1){            
        //pg = ApexPages.currentPage();
        //pg.setRedirect(false);
        pg = new PageReference('/apex/OppListViewVF');

        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM, 'Records saved successfully!!')); 
        //}  
    }
    }catch(Exception exx){
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'An error occured on the page.Please try again reloading the page.'));
    }
    return pg;    
    } 
    
    public PageReference doCancel(){ 
    PageReference pgc;
   
    PageReference p =  this.controller.cancel();
    if(p != null){
        pgc = new PageReference('/apex/OppListViewVF');
    }
        return pgc;
    }
        
}



 
ShashankShashank (Salesforce Developers) 
You may have to check if you have access to that particular list view.
bappabappa
Yes I have access on that list view,from standard list view I checked that. It is happening only for the list views with Fiscal period in custom page. Thanks, Bappa
ShashankShashank (Salesforce Developers) 
This is currently a limitation in Visualforce functionality. The Fiscal Period field is not accessible via the API. Since visualforce/apex technically uses the API for its functionality, you are facing this issue. Salesforce R&D is working on this as of now.

As a workaround, you can instead use the Fiscal Year and Fiscal Quarter combination in the list view to avoid this error.