0
Public class CaseHandler{

Public static void updatecasefields(){
List<Case> lstcase = new list<case>();

for (Case cs: lstcase)
    {
        If(cs.Issue_Sub_Type__c != null && cs.Issue_Type__c != null)
        {
            List<custom_object__C> Casp = [SELECT Id, Carrier_Name__c, Category__c, Issue_Sub_Type__c,Issue_Type__c,Turnaround_Time_Days__c FROM custom_object__C WHERE Carrier_Name__c = :cs.CarrierName__c AND Category__c = :cs.Category__c AND Issue_Type__c = :GiDP_Issue_Type__c AND Issue_Sub_Type__c = :cs.Issue_Sub_Type__c];
                                        
            for(custom_object__C  CP: Casp)
        {
               cs.Turnaround_Time_Days__c = cp.Turnaround_Time_Days__c;
               
               
               
            }
        }
    }


}


}

//Trigger

trigger CaseTrigger on Case ( before update)
{
if (Trigger.isUpdate) {    
CaseHandler CShandler = new CaseHandler();

CShandler.updatecasefields();

}
}

*** Error****

Static method cannot be referenced from a non static context: void CaseHandler.updatecasefields()

1
  • 1
    Welcome to SFSE. I've linked a post that covers this challenge pretty well. As a general rule of thumb, please take a moment to search the text of an error - you'll usually find many examples of how to deal with it.
    – David Reed
    Dec 30 '20 at 5:13

Browse other questions tagged or ask your own question.