Business Hours
Business Hours
The BusinessHours operation selects an exit according to the rules applied at the current Time of Day, Day of Week and
Day of Year. It is one of the most complex operation structures in the Flow Editor.
The BusinessHours operation must have at least one exit. The BusinessHours operation is only
useful when it has more than one exit, although this is not enforced by the operation definition.
Config Parameters
The BusinessHours operation config attributes are as follows.
| Parameter | Type | Description |
|---|---|---|
timezone
|
String |
An IANA identifier for the timezone to use when applying the operation rules. (Default = timezone on the ACD processing node, typically UTC) |
holiday_set
|
String |
[Required] The name of a holiday set owned by (or accessible to) the same customer that owns the service and flow. This set must contain all of the holiday entries referenced within the operation rules.
|
holiday_set_customer_name
|
String |
[Required] The name of the customer that owns holiday_set.
|
rules
|
Array of Object |
The rules Array must contain zero or more Objects.
|
default_exit_idx
|
Integer | [Required] The zero-based index number of the exit to use as the default exit. |
Config Rules
The attributes for each BusinessHours operation rules Object takes one of the following forms.
| Parameter | Type | Description |
|---|---|---|
days
|
String |
One of any (matches all days),
mmdd (matches a calendar day or range of calendar days),
holiday_entry (matches one of the named holidays),
any_holiday (matches any holiday in the set), or
dow (matches a single day of week or range of days of week).
|
start_day
|
Integer |
This parameter is permitted and mandatory only when days = dow. It must be in the range 0
(Sunday) to 6 (Saturday). This is the last (inclusive) day of week that will be matched by this rule.
|
end_day
|
Integer |
This parameter is permitted and mandatory only when days = dow. It must be in the range 0
(Sunday) to 6 (Saturday). This is the first (inclusive) day of week that will be matched by this rule.
Note that end_day may wrap around and hence be less than start_day.
|
start_mmdd
|
String |
This parameter is permitted and mandatory only when days = mmdd. It must be in the range 0101
(January 1st) to 1231 (December 31st) and must specify a valid four-digit Month + Day of Month.
This is the first date (inclusive) of the date range that will be matched by this rule.
|
end_mmdd
|
String |
This parameter is permitted and mandatory only when days = mmdd. It must be in the range 0101
(January 1st) to 1231 (December 31st) and must specify a valid four-digit Month + Day of Month.
This is the last date (inclusive) of the date range that will be matched by this rule.
|
holiday_entries
|
Array of String |
This parameter is permitted and mandatory only for days = holiday_entry, and specifies
the names of the system-configured named holidays (which may possibly be multi-day holidays) which
will match for this rule. These named holiday must exist within the holiday set indicated by
the holiday_set parameter in the config Object.
|
exit_idx
|
Integer |
The zero-based index number of the exit to follow if this rules matches. The exit_idx parameter
should only be present when Time of Day routing is absent for a rule. Every rule must specify
exactly one of exit_idx or in_hours_exit_idx.
|
in_hours_exit_idx
|
Integer |
The zero-based index number of the exit to follow if time-based matching is present for this rule,
if the day matches, and if the current time falls within the configured hours for the rule. This
parameter may and must be present if and only if exit_idx is not present.
|
out_of_hours_exit_idx
|
Integer |
The zero-based index number of the exit to follow if time-based matching is present for this rule,
if the day matches, and if the current time falls outside the configured hours for the rule. This
parameter is not mandatory, and may be present if and only if in_hours_exit_idx is present.
|
start_hhmm
|
String |
A string in the range 0000 to 2359 indicating the start of time of day matching period for this
rule (if one exists). This parameter is permitted and mandatory if and only if end_hhmm is also present.
|
end_hhmm
|
String |
A string in the range 0001 to 2400 indicating the end of time of day matching period for this
rule (if one exists). This parameter is permitted and mandatory if and only if start_hhmm is also present,
and it must be different from start_hhmm. If this value is less than start_hhmm then it represents a
wrap-around period which includes midnight.
|
Matching Date and Time
When determining if a rule matches, first check the “Day” part of the rule, as follows:
-
days=any: Always matches. -
days=mmdd,start_mmdd= [MMDD],end_mmdd= [MMDD]: Matches if the month/day is within the indicated range (inclusive). -
days=dow,start_day= [0-6],end_day= [0-6]: Matches if the current day of week number is within the indicated range (inclusive) where Sunday =0, Saturday =6. -
days=holiday_entry,holiday_entries= [Array of Entry Names]: Matches if the current day matches any of the days associated with any of the named holiday entries. -
days=any_holiday: Matches if the current day matches any of the days associated with any of the holiday entries in the configuredholiday_set.
If day does not match, then proceed to the next rule (or use default_exit_idx if no more rules remain).
If day matches, proceed to matching the current time according to the rule’s exit_idx, start_hhmm, end_hhmm,
in_hours_exit_idx, and out_of_hours_exit_idx based on the following permitted time rule parameter combinations:
-
exit_idxonly: No checking on current time of day is required, the rule always matches any time of day. -
start_hhmm,end_hhmm, andin_hours_exit_idxonly: If the current time of day matches the indicated 24-hour clock HHMM range, then follow the in-hours exit index, otherwise this rule does not apply. -
start_hhmm,end_hhmm,in_hours_exit_idx, andout_of_hours_exit_idxall present: If the current time of day matches the indicated 24-hour clock HHMM range, then follow the in-hours exit index, otherwise follow the out-of-hours exit.
If no rule matches, then the exit indicated by default_exit_idx will be taken.
Example Operation
Here is an example BusinessHours operation in JSON representation.
{
"id": 5,
"type": "BusinessHours",
"config": {
"holiday_set": "National Holidays",
"rules": [
{ "days": "holiday_entry", "holiday_entries": [ "Easter Weekend" ], "exit_idx": 1 },
{ "days": "mmdd", "start_mmdd": "0401", "end_mmdd": "0401",
"start_hhmm": "1200", "end_hhmm": "1500",
"in_hours_exit_idx": 0, "out_of_hours_exit_idx": 1
},
{ "days": "any_holiday", "exit_idx": 1 },
{ "days": "dow", "start_day": 1, "end_day": 5,
"start_hhmm": "0900", "end_hhmm": "1730",
"in_hours_exit_idx": 0, "out_of_hours_exit_idx": 1
},
{ "days": "any", "start_hhmm": "0600", "end_hhmm": "2400", "in_hours_exit_idx": 2 }
],
"default_exit_idx": 1
},
"exits": [ 4, 17, 33 ]
}
The rules will be evaluated for the current date and time for the default timezone in the following sequence. All Holidays are as defined in a holiday set named “National Holidays”.
-
Between Good Friday and Easter Monday, follow exit index
1to the operation with ID17. -
On April 1st, between noon and 3 PM follow exit index
0to the operation with ID4, else follow exit index1to the operation with ID17. -
On any holiday, follow exit index
1to the operation with ID17. -
Between Monday and Friday, between 9 AM and 5:30 PM follow exit index
0to the operation with ID4, else follow exit index1to the operation with ID17. -
Any other day between 6 AM and midnight, follow exit index
2to the operation with ID33. -
Otherwise follow the default exit index
1to the operation with ID17.
Exits
By convention the first exit represents the processing for “Closed” hours, and the second exit
for “Open” hours, with any additional exits representing secondary/alternate Open Hours. However, this is
purely a convention, and the definition of the BusinessHours operation does not rely on any
particular intepretation of exits.
| Exit Index | Name | Description |
|---|---|---|
0
|
Exit #1 |
[Required]
All BusinessHours operations must have at least one exit.
|
1
|
Exit #2 + | Additional exits may be present. |