Business Hours and Public Holidays for Next Service Recommendations

The Restocker create next service modal screenflow relies on Salesforce's Business Hours in order to detect and suggest dates that land on weekdays and non-public holiday days.

Business Hours must be configured for the business at a top level.

Adding Public Holidays

Public holidays are held in Business Hours, one set per region. A holiday only affects the regions it is attached to.

  1. In Setup, search for Holidays and click New. Enter a name and the date. Tick Recurring Holiday for holidays that fall on the same date every year (Salesforce also supports rules such as "second Monday").
  2. In Setup, search for Business Hours and open the record named Restocker plus the region (for example Restocker QLD).
  3. In the Holidays related list, click Add/Remove, tick the holiday and save.
  4. Repeat for every region the holiday applies to. State public holidays differ, so a holiday must be added to each region's business hours separately.
  5. To remove a holiday from a region, use Add/Remove again and untick it. A holiday that is still attached to any business hours cannot be deleted.

Check or Fix a User's Region

The flow reads Region from the running user's record (QLD, NSW, SA, TAS, ACT, NT, VIC, NAT). Open the user in Setup and check the Region field. The Business Hours names must match: Restocker followed by a space and the region code.

Adding a New Region

  1. Create a Business Hours record named Restocker XXX (the region code), open Monday to Friday, closed Saturday and Sunday, with the region's timezone.
  2. Make sure the region also exists in the user Region list.
  3. The helper uses the region to decide the timezone through FieldTimeZoneHelper. A region that is not listed there uses Sydney time. Ask a developer to add it if the new region is in a different timezone.

Troubleshooting

What you seeLikely cause and what to check
A suggested date is a weekendIt should not be unless you used the custom option. Check the flow is the current version and that the region on the user record is spelled as one of the region codes.
A public holiday is not skippedThe holiday has not been added to that region's Business Hours (or was added to a different region). Check the holiday's Business Hours.
Weekends are avoided but holidays never are, for a whole regionThe region's Business Hours record may be missing or inactive. The helper then falls back to plain Monday to Friday.
A date lands a day later than expectedWhen a day before and a day after are equally near, the later day is used. For example a Saturday after a holiday Friday goes to Monday.
An error about Apex or access when the screen opensThe user's permission set does not include the RestockerNextOpenDayHelper Apex class. Check the Restocker Restockist Permissions permission set is assigned.
No suggested date for account frequencyThe account has no Service Frequency (unchanged behaviour). Use the location frequency or a custom date.