For some reason when I attempt to use the
BusinessHours.isWithin method within Salesforce I get the following error:
Compile failure on line 4, column 34: Method does not exist or incorrect signature: void isWithin(Id, Datetime) from the type BusinessHours
Here is the simple code I used to generate this error in anonymous apex:
BusinessHours businessHours = [SELECT Id FROM BusinessHours WHERE IsDefault=TRUE]; System.debug('Business Hours:' + businessHours); Boolean isWithin = BusinessHours.isWithin(businessHours.Id, System.now()); System.debug('isWithin:' + isWithin);
Any ideas on why I'm getting this error?