Introduction
Many enterprise integrations—especially in payroll, finance, and compliance—must run on a specific working day of the month, such as the 3rd working day.
Oracle Integration Cloud (OIC) schedulers do not natively support “working day” logic, so this requirement must be handled through custom orchestration logic.
This blog explains a reliable and production-ready approach using OIC Scheduler + JavaScript action, with support for weekends and holidays.
Use Case / Business Scenario
An integration must run only on the 3rd working day of every month
Working days exclude:
Saturdays and Sundays
Company or regional holidays
The job should:
Automatically adapt to month start falling on weekends
Not require manual intervention every month
Typical Examples
Payroll file generation
Vendor payment processing
Month-start financial reports
Regulatory data submission
Challenges in OIC
OIC scheduler does not understand working days
iCal or Simple schedules cannot handle:
Weekend exclusion
Holiday calendars
Solution Overview
Design Pattern
Schedule the integration daily and control execution using JavaScript logic
Javascript code used:
function getThirdWorkingDate (currentDate, holidayList) {
// Parse the date
var today;
if (currentDate instanceof Date) {
today = new Date (currentDate);
} else if (typeof currentDate === 'string') {
// Handle different date formats
if (currentDate.includes ('T')) {
today = new Date (currentDate);
} else {
today = new Date (currentDate + 'T00:00:00');
}
} else {
// If no valid date provided, use current date
today = new Date();
}
var year = today.getFullYear();
var month = today.getMonth();
// Start from the first day of the month
var d = new Date (year, month, 1);
// Prepare holiday lookup
var holidays = {};
if (holidayList) {
if (typeof holidayList === 'string') {
var items = holidayList.split(',');
for (var i = 0; i < items.length; i++) {
holidays [items[i].trim()] = true;
} } else if (Array.isArray (holidayList)) {
for (var j = 0; j < holidayList.length; j++) {
holidays [String (holidayList (j))] = true;
}
}
}
var workingDayCount = 0;
// Loop through up to 31 days
for (var k = 0; k < 31; k++) {
var dayOfWeek= d.getDay(); //0=Sunday, 6-Saturday
// Format date as YYYY-MM-DD
var dateStr = d.getFullYear() + "-" +("0" + (d.getMonth() + 1)).slice(-2) + "-" +("0" + d.getDate()).slice(-2);
// Check if it's a working day (not weekend, not holiday)
if (dayOfWeek > 0 && dayOfWeek < 6 && !holidays [dateStr]) {
workingDayCount++;
if (workingDayCount ===3){
return dateStr;
}
}
// Move to next day
d.setDate(d.getDate() + 1);
}
// If no third working day found
return dateStr;
}
console.log(getThirdWorkingDate("2026-02-01","2026-02-03,2026-02-20"))
Key Components:
Daily scheduled integration
JavaScript action to calculate the 3rd working day
External holiday list (Lookup / DB / File)
Switch activity to control execution
Solution Steps
Step 1: Schedule the Integration Daily
Use Simple or iCal schedule
Run once every day (early morning preferred)
Step 2: Maintain Holiday Calendar
Store holidays in:
OIC Lookup (recommended)
Database table
Stage file
Pass holiday list to integration as:
YYYY-MM-DD,YYYY-MM-DD
Step 3: Pass Current Date
Use Assign action:
format-dateTime(ora:current-dateTime(), "[Y0001]-[M01]-[D01]")
This ensures: Correct timezone handling and Consistent date format
Step 4: Calculate 3rd Working Day (JavaScript Action)
JavaScript receives:
Current date
Holiday list
Logic:
Start from 1st of the month
Skip weekends
Skip holidays
Identify the 3rd working day
Return the calculated date
Step 5: Control Execution Using Switch
Condition:
currentDate = thirdWorkingDate
True → Execute business logic
False → End integration
Benefits of This Approach
- Fully automated
- Handles weekends and holidays correctly
- No hardcoding of dates
- Reusable across multiple integrations
- Easy to explain in audits and design reviews
Conclusion
Oracle Integration Cloud does not provide a built-in way to schedule jobs on the “Nth working day.”
However, by combining daily scheduling with JavaScript logic, you can achieve a clean, flexible, and enterprise-ready solution.
Best practice:
Let the scheduler run daily and let the integration decide when to execute.


No comments:
Post a Comment