nextStartDate in Salesforce Business Hours

nextStartDate in Salesforce Business Hours

Starting from the specified target date, returns the next date when business hours are open. If the specified target date falls within business hours, this target date is returned.

Sample Code:

BusinessHours bh = [
    SELECT Id 
    FROM BusinessHours 
    WHERE IsDefault = true
];
Datetime nextStart = BusinessHours.nextStartDate(
    bh.id, system.today()
);
system.debug(
    'Next Start Date is ' 
    + nextStart
);

Leave a Reply