Skip to content

Iamshankha/Adaptive Scheduler – Automated Report Scheduling with Business Day Awareness#1951

Closed
iamshankha wants to merge 2 commits intoServiceNowDevProgram:mainfrom
iamshankha:iamshankha/Adaptive-Scheduler
Closed

Iamshankha/Adaptive Scheduler – Automated Report Scheduling with Business Day Awareness#1951
iamshankha wants to merge 2 commits intoServiceNowDevProgram:mainfrom
iamshankha:iamshankha/Adaptive-Scheduler

Conversation

@iamshankha
Copy link
Contributor

@iamshankha iamshankha commented Oct 8, 2025

PR Description:

🗓️ Adaptive Scheduler – Automated Report Scheduling with Business Day Awareness

📘 Overview

The Smart Quarterly Scheduler automates report execution for quarterly business reviews. It ensures that scheduled reports never fall on weekends or Fridays, maintaining consistent and reliable delivery.

🧩 Problem Statement

The business requires a quarterly report to run on the 2nd day of specific months (February, May, August, and November). However, when the 2nd day falls on a Friday or weekend, the client team will be typically on leave and may miss reviewing urgent reports.
This results in communication delays and missed insights during critical business periods.

💡 Solution

This script dynamically checks whether the 2nd day of the quarterly month is a Friday or weekend:

If yes → the report automatically runs on the 5th day.

If no → the report runs as usual on the 2nd day through another Scheduled Report.

It uses GlideDateTime logic to determine execution dynamically within the Scheduled Report Condition.

🚀 Benefits

⏰ Minimizes manual scheduling effort

✅ Ensures reports always run on valid business days

📊 Maintains consistent quarterly performance insights

🔁 Completely automated logic without admin dependency

Pull Request Checklist

Overview

  • Put an x inside of the square brackets to check each item.
  • I have read and understood the CONTRIBUTING.md guidelines
  • My pull request has a descriptive title that accurately reflects the changes and the description has been filled in above.
  • I've included only files relevant to the changes described in the PR title and description
  • I've created a new branch in my forked repository for this contribution

Code Quality

  • My code is relevant to ServiceNow developers
  • My code snippets expand meaningfully on official ServiceNow documentation (if applicable)
  • I've disclosed use of ES2021 features (if applicable)
  • I've tested my code snippets in a ServiceNow environment (where possible)

Repository Structure Compliance

  • I've placed my code snippet(s) in one of the required top-level categories:
    • Core ServiceNow APIs/
    • Server-Side Components/
    • Client-Side Components/
    • Modern Development/
    • Integration/
    • Specialized Areas/
  • I've used appropriate sub-categories within the top-level categories
  • Each code snippet has its own folder with a descriptive name

Documentation

  • I've included a README.md file for each code snippet
  • The README.md includes:
    • Description of the code snippet functionality
    • Usage instructions or examples
    • Any prerequisites or dependencies
    • (Optional) Screenshots or diagrams if helpful

Restrictions

  • My PR does not include XML exports of ServiceNow records
  • My PR does not contain sensitive information (passwords, API keys, tokens)
  • My PR does not include changes that fall outside the described scope

Adaptive Scheduler
Purpose:
Automates quarterly report scheduling by intelligently adjusting the run date based on weekends or Fridays.

Business Logic:
The report is configured to run monthly on the 5th day.
The script checks if the 2nd day of the quarterly month (February, May, August, November) falls on a Friday or weekend.
If the 2nd day falls on a Friday or weekend, the scheduled report will run on the 5th day instead.
If the 2nd day is a regular business day, the report will already be sent on the 2nd day of that month.

💡 Benefit:
⏰ Minimizes manual intervention and ensures reports always run on valid business days — maintaining consistent quarterly reporting.

Type: Server-side Script (Scheduled Report Condition)
Run: Monthly
Day: 5
🗓️ Adaptive Scheduler

📘 Overview

The Smart Quarterly Scheduler automates report execution for quarterly business reviews. It ensures that scheduled reports never fall on weekends or Fridays, maintaining consistent and reliable delivery.

🧩 Problem Statement

The business requires a quarterly report to run on the 2nd day of specific months (February, May, August, and November). However, when the 2nd day falls on a Friday or weekend, the client team will be typically on leave and may miss reviewing urgent reports.
This results in communication delays and missed insights during critical business periods.

💡 Solution

This script dynamically checks whether the 2nd day of the quarterly month is a Friday or weekend:

If yes → the report automatically runs on the 5th day.

If no → the report runs as usual on the 2nd day through another Scheduled Report.

It uses GlideDateTime logic to determine execution dynamically within the Scheduled Report Condition.

🚀 Benefits

⏰ Minimizes manual scheduling effort

✅ Ensures reports always run on valid business days

📊 Maintains consistent quarterly performance insights

🔁 Completely automated logic without admin dependency
@ravichandra1998g ravichandra1998g self-assigned this Oct 8, 2025
Copy link
Contributor

@ravichandra1998g ravichandra1998g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a descriptive Title and PR Description for the Pull Request

@iamshankha iamshankha changed the title Iamshankha/adaptive scheduler Iamshankha/Adaptive Scheduler – Automated Smart Scheduling for Reports Oct 8, 2025
@iamshankha iamshankha changed the title Iamshankha/Adaptive Scheduler – Automated Smart Scheduling for Reports Iamshankha/Adaptive Scheduler – Automated Report Scheduling with Business Day Awareness Oct 8, 2025
@iamshankha
Copy link
Contributor Author

Please add a descriptive Title and PR Description for the Pull Request

Thank you for your inputs. I have made the required changes. Requesting you to review the same.

Copy link
Contributor

@ravichandra1998g ravichandra1998g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @iamshankha

Thank you for submitting!

I will mark this PR as a Hactoberfest accepted and approve it so that it counts towards your Hactoberfest contribution.

But we cannot merge this aa we have a similar code snippets under GlideDateTime folder under Core ServiceNow APIs and we also have similar code existing under Schedule Job Folder already.

  • For Hactoberfest, we are aiming for high quality contributions which will be beneficial for the open source community. Please make unique contributions for your upcoming PRs.

@ravichandra1998g ravichandra1998g added the hacktoberfest-accepted The PR is accepted for Hacktoberfest, regardless of being merged or not label Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted The PR is accepted for Hacktoberfest, regardless of being merged or not

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants