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
Nikhil M KumarNikhil M Kumar 

Error: Apex class doesn't exist! But, my class exists. It keeps showing that it doesn't!

<apex:page renderAs="pdf" controller="MenuTMS">
    <center><h1>
        Generated Bill!
        </h1></center>
    <apex:pageBlock>
        <apex:pageBlockSection>
            <apex:outputField value="{! MenuTMS.Name }" />
            <apex:outputField value="{! MenuTMS.Price }" />
            <apex:outputField value="{! MenuTMS.Quantity }" />
            <apex:outputField value="{! MenuTMS.Amount }" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

 
Nayana KNayana K
Please post the MenuTMS class code as well.
Nikhil M KumarNikhil M Kumar
public class MenuTMS {
    
    public static void saveMenu(){
        PageReference pageRef = new PageReference('apex/TMSMenuBillPage');
        
        List <sObject> Name = [ SELECT Item__c.Name FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        List <sObject> Price = [ SELECT Item__c.Price__c FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        List <sObject> Quantity = [ SELECT Item__c.Quantity__c FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        
        System.debug('Items ordered..\n' + Name + '    ' + Price + '    ' + Quantity + '    ' );
        
    }
}
Nayana KNayana K
public class MenuTMS {
    
public MenuTMS() {}

    public static void saveMenu(){
        PageReference pageRef = new PageReference('apex/TMSMenuBillPage');
        
        List <sObject> Name = [ SELECT Item__c.Name FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        List <sObject> Price = [ SELECT Item__c.Price__c FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        List <sObject> Quantity = [ SELECT Item__c.Quantity__c FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        
        System.debug('Items ordered..\n' + Name + '    ' + Price + '    ' + Quantity + '    ' );
        
    }
}

Just added a constructor in the code. Please check now.
Nayana KNayana K
public class MenuTMS {
    public MenuTMS(){}
    public static void saveMenu(){
        PageReference pageRef = new PageReference('apex/TMSMenuBillPage');
        
        List <sObject> Name = [ SELECT Item__c.Name FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        List <sObject> Price = [ SELECT Item__c.Price__c FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        List <sObject> Quantity = [ SELECT Item__c.Quantity__c FROM Item__c WHERE Item__c.Quantity__c != NULL ];
        
        System.debug('Items ordered..\n' + Name + '    ' + Price + '    ' + Quantity + '    ' );
        
    }
}

I just noticed that if I style it to bold, it is showing as <b>public MenuTMS() {}</b> which is wrong.

Please try above code.
Nikhil M KumarNikhil M Kumar
I tried. It still shows the same error!