Business Hours Toolkit
Complete suite of four Flow invocable actions for business-hours-aware date calculations, time differences, schedule checks, and next-open-date lookups.
Overview
The Business Hours Toolkit bundles four Salesforce Flow invocable actions into a single deployable package. Together they give your Flows complete control over Salesforce Business Hours — adding time, measuring elapsed time, checking whether a moment is inside working hours, and finding the next open window.
Each action wraps a native BusinessHours platform method and exposes it as a no-code Flow action. All four respect your org's Business Hours configuration including holidays, so SLA calculations, scheduling logic, and after-hours routing work correctly out of the box.
What's Included
| Action | What It Does | Platform Method |
|---|---|---|
| Add Business Hours | Adds a time interval while only counting working hours | BusinessHours.add() |
| Calculate Business Hours Difference | Measures elapsed time between two DateTimes in business hours only | BusinessHours.diff() |
| Calculate Is Inside Business Hours | Checks if a DateTime falls within active business hours | BusinessHours.isWithin() |
| Calculate Next Business Date | Finds the next DateTime when business hours are open | BusinessHours.nextStartDate() |
When to Install the Toolkit
- You need two or more of these actions — the toolkit deploys all four in one step
- You're building SLA-aware automation that requires multiple business hours calculations
- You want a single source of truth for all business hours logic in your org
When to Install Individual Actions Instead
- You only need one specific action — install just that component to keep your org lean
- You have strict change management policies and prefer smaller, targeted deployments
- Visit each action's page for standalone installation: Add Business Hours, Calculate Business Hours Difference, Calculate Is Inside Business Hours, Calculate Next Business Date
User Guide
Getting Started
- Ensure you have a Business Hours record configured in Setup (Setup > Company Settings > Business Hours)
- Note the Business Hours Id — every action in this toolkit requires it as an input
- Deploy the toolkit to your org using the SFDX command below
- In Flow Builder, search for "Professor Flow" to find all four actions
- Drag any action onto your canvas and map the Business Hours Id and DateTime inputs
Actions Quick Reference
Add Business Hours
DateTimeThe DateTime to start from
TextThe record Id of the Business Hours to use
NumberTime interval to add, in milliseconds
DateTimeThe resulting DateTime after adding the interval during business hours only
Calculate Business Hours Difference
TextThe record Id of the Business Hours to use
DateTimeThe beginning of the time range to measure
DateTimeThe end of the time range to measure
NumberDifference in milliseconds, counting only business hours
NumberDifference in seconds, counting only business hours
NumberDifference in minutes, counting only business hours
Calculate Is Inside Business Hours
DateTimeThe DateTime to evaluate
TextThe record Id of the Business Hours to check against
BooleanTrue if the DateTime falls inside business hours; false otherwise
Calculate Next Business Date
DateTimeThe DateTime to start searching from. Returned as-is if already within business hours.
TextThe record Id of the Business Hours to evaluate against
DateTimeThe next DateTime when business hours are open
Common Patterns
SLA Deadline Calculation: Use Add Business Hours to project a deadline from case creation, then Calculate Is Inside Business Hours to verify follow-ups land during working hours.
Elapsed Time Reporting: Use Calculate Business Hours Difference between two milestones (e.g., case created vs. case resolved) to get actual working-hours duration for SLA compliance dashboards.
Smart Scheduling: Use Calculate Next Business Date to ensure automated tasks, notifications, or assignments only trigger during open hours. Pair with Calculate Is Inside Business Hours for conditional routing.
Troubleshooting
- "Business Hours Id is required" — Every action requires a valid Business Hours record Id. Query it from the
BusinessHoursobject or hardcode a known Id in a Flow constant. - Results seem off by a day — DateTime values are timezone-sensitive. The
Add Business Hoursaction returns results in the running user's local time zone. Verify your org's timezone settings match expectations. - Holidays not being respected — Ensure holidays are associated with the correct Business Hours record in Setup. Only holidays linked to the specific Business Hours Id you pass will be factored in.
Code
The toolkit repo contains all four actions and their test classes in a standard SFDX project structure:
force-app/main/default/classes/
├── addBusinessHours.cls — Add time interval during business hours
├── addBusinessHoursTest.cls — Test class
├── CalculateBusinessHoursDiff.cls — Measure elapsed business hours
├── CalculateBusinessHoursDiffTest.cls— Test class
├── calculateIsInsideBusinessHours.cls — Check if DateTime is in business hours
├── calculateIsInsideBusinessHoursTest.cls — Test class
├── CalculateNextBusinessDate.cls — Find next open business date
└── CalculateNextBusinessDateTest.cls — Test class
Deploy the entire toolkit with a single command:
sf project deploy start --source-dir force-app
All classes use API version 66.0 (Spring '26) and the global access modifier for Flow visibility.