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
Renee NicholusRenee Nicholus 

Schedulable Class Error: Static method cannot be referenced from a non static context

Receiving this error when trying to schedule this class.  

line: 6, Column: 41
Dependent class is invalid and needs recompilation: Class UpdateCSBHSchedulable : Static method cannot be referenced from a non static context: void updateCurrentStatusBusinessHours.updateBusinessHours()

I added the bold when I got an apex time limit exceeded error when trying to run - I read that I needed to change to a future method, but I wasn't sure of everything that needed to be changed. Are there other parts I need to adjust to make this a valid future method, and clear the 
"Static method cannot be referenced from a non static context" error?

Class below:

public class updateCurrentStatusBusinessHours
{
    @future
    public static void updateBusinessHours()
{
    
     List<SBQQ__Quote__c> SBQQs = [SELECT Approval_Status_Start_Time__c, Status_Start_Time__c FROM SBQQ__Quote__c 
                                  WHERE  RecordTypeId IN ('012U00000001s4PIAQ','0120B0000001w3OQAQ', '0120B0000001w3JQAQ','012U0000000EB4BIAW') AND
                                         Opportunity_Stage__c != 'Closed - Won (100%)' AND Approval_Status_Start_Time__c != null AND Status_Start_Time__c != null];        
     System.debug(SBQQs);
        
        BusinessHours BusinessHoursId = [SELECT Id FROM BusinessHours WHERE IsActive=true AND name= 'CSS' LIMIT 1];
     for (SBQQ__Quote__c SBQQ : SBQQs)
    { 
        //Input
        Datetime ASST = SBQQ.Approval_Status_Start_Time__c ;
        Datetime SST  = SBQQ.Status_Start_Time__c;
        
        //Approval Status Calc
        Decimal ASSTdiffHours = BusinessHours.diff(businessHoursId.id, ASST, system.now());
        Decimal ASSTdiff = ASSTdiffHours/3600000;  // converting milliseconds into Hour
        
        //Status Calc
        Decimal SSTdiffHours = BusinessHours.diff(businessHoursId.id, SST, system.now());
        Decimal SSTdiff = SSTdiffHours/3600000;  // converting milliseconds into Hours
    
        //Output
        SBQQ.Approval_Status_Business_Hours_CST_SF__c = ASSTdiff;
        SBQQ.Status_Business_Hours_CST_SF__c = SSTdiff;
        SBQQ.Last_Current_Status_Run_Time__c = system.now();
    }
        //Update all records
        update SBQQs;
        
  }
}
AbhishekAbhishek (Salesforce Developers) 
https://salesforce.stackexchange.com/questions/53665/how-to-troubleshoot-dependent-class-is-invalid-and-needs-recompilation-excep

https://salesforce.stackexchange.com/questions/194492/static-method-cannot-be-referenced-from-a-non-static-context-liststring

Go through the methods as suggested above.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.