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 input date */
var today = new Date(currentDate + "T00:00:00");
/* First day of month */
var year = today.getFullYear();
var month = today.getMonth(); // 0-based
var firstDay = new Date(year, month, 1);
/* Normalize holidays into lookup map */
var holidays = {};
if (holidayList) {
// Case 1: holidayList is a STRING
if (typeof holidayList === "string") {
var arr = holidayList.split(",");
for (var i = 0; i < arr.length; i++) {
holidays[arr[i].trim()] = true;
}
}
// Case 2: holidayList is an ARRAY
else if (Array.isArray(holidayList)) {
for (var j = 0; j < holidayList.length; j++) {
holidays[String(holidayList[j])] = true;
}
}
}
var workingDayCount = 0;
/* Loop until 3rd working day */
for (var d = new Date(firstDay); ; d.setDate(d.getDate() + 1)) {
var dayOfWeek = d.getDay(); // 0=Sun, 6=Sat
var dateStr =
d.getFullYear() + "-" +
("0" + (d.getMonth() + 1)).slice(-2) + "-" +
("0" + d.getDate()).slice(-2);
/* Working day = weekday + not holiday */
if (dayOfWeek !== 0 && dayOfWeek !== 6 && !holidays[dateStr]) {
workingDayCount++;
if (workingDayCount === 3) {
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