Business Calendar Validator #151
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Business Calendar Validator
The Business Calendar Validator is a custom Flow Action for ServiceNow that checks whether a given date/time falls within business hours, holidays, or maintenance windows defined in a Business Calendar.
📌 Description
This action helps automate decisions based on business schedules. It supports validation against:
⚙️ Inputs
Name, Type, Description, calendar_name, StringName of the Business Calendar to use|
input_datetime| DateTime | The date/time to validate (format:YYYY-MM-DD HH:mm:ss) ||
check_type| String | One of:Business Hours,Holiday,Maintenance Window||
timezone| String | Optional timezone (e.g.,Asia/Kolkata) |📤 Outputs
Name, Type, Description, is_valid, True if the input datetime is valid|
message| String | Human-readable result message ||
next_valid_time| DateTime | Next valid time slot (only for Business Hours check) |🚀 Usage
Use this action in Flow Designer to:
✅ Example: Valid Input
Valid Input
{
"calendar_name": "8-5 weekdays",
"input_datetime": "2025-10-10 14:30:00",
"check_type": "Business Hours",
"timezone": "Asia/Kolkata"
}
Output
{
"is_valid": true,
"message": "Within business hours.",
"next_valid_time": ""
}
Invalid input
{
"calendar_name": "8-5 weekdays",
"input_datetime": "2025-10-12 14:30:00",
"check_type": "Business Hours",
"timezone": "Asia/Kolkata"
}
Output
{
"is_valid": false,
"message": "Outside business hours.",
"next_valid_time": "2025-10-13 08:00:00"
}