This article was originally published on LinkedIn.
One of the awesome features of Logic App consumption based and standard is the the possibilty to schedule your runs with the Recurrence trigger that the platform offers.
I have used this trigger on many integrations that I have delivered to my clients over the years. And as one can see in the following picture, the trigger provides all options to schedule workflows as needed.

The problem
Nevertheless, recently I got a requirement from the client that specific workflows should only be fired on the 8th business day of each month.
The rationale behind this requirement is that – over the month – various internal systems deliver data to our platform, with a specific cut off on the 7th business day of the month. The data from these sources is then used by this integration to trigger complex calculations on the 8th business day of the month.
A limitation of the recurrence trigger
I was under the assumption that the recurrence trigger would have an option to schedule on specific business days in a month, but I clearly was not aware that this functionality just doesn’t exist. And even though I have seen some questions on the internet around this topic, I could not find a clear approach to tackle this issue.
The recurrence trigger has the option to:
- Schedule runs by month (run each n’th month, from a specific date)
- Schedule runs by week (run each n’th week, with a start time, on specific days, on specific hours/minutes)
- Schedule runs by day (n’th day, start time, hours/minutes)
- Schedule runs by hour, minute, seconds
The solution: Create something
yourself
Since there isn’t a built-in solution to run workflows on a specific business day, I decided to do some investigation and come up with a solution by myself (Most solutions are best when created by yourself anyway ;-))
In the next section I will therefore how to tackle this requirement with use of some standard workflow actions (and some lines of custom JavaScript, but the same can be achieved with C#).
Ingredients:
- the existing recurrence trigger that is scheduled on weekdays.
- a public holidays API, because these holidays need to be taken into account when determining a specific business day in a month.
- a custom created JavaScript that takes the holidays into account and determines the date of the n’th business day.
- a workflow if condition action to check if current date equals the date from the JavaScript. If not, just cancel the run.
So if we start with the end in mind, the workflow should look like this:

1. Use the existing recurrence trigger
Yup, that’s correct!
The workflow will need to run on a (work)daily base, so that the logic can check if we have reached the n’th business day. Therefore, the workflow should runon a weekly frequency on Monday, Tuesday, Wednesday, Thursday and Friday.

2. Get public holidays for your country
Public holidays will impact what is considered a specific business day in a month, expecially if the public holiday is on a weekday.
Therefore these holidays should be taken into account. In order to do so, I’m using the API of OpenHolidays API, But any other approach that returns a JSON array of holiday dates would do fine.
In essence, it is a public API with the following URL: openholidaysapi.org/PublicHolidays?countryIsoCode=NL&languageIsoCode=NL&validFrom=2025-01-01&validTo=2025-12-31
- countryIsoCode and languageIsoCode refers to the 2 digit code of a country, in my case this is the Netherlands (NL).
- validFrom / validTo. Since the logic is interested in all public holidays of this year, I just use a validFrom of 2025-01-01 and a validTo of 2025-12-31
The result is a JSON array as shown in the next picture:

This URL is then used in a workflow HTTP action to retrieve all public holidays for the current year.

- The expressions in the URL are both the same and gives the current year, to make it a generic call to the API
formatDateTime(utcNow(), 'yyyy')
JavaScript to return the date of the n’th business day in a month
Now with the public holidays in our pocket, some custom JavaScript code needs to be executed to get the date for a specific business day in the month. The JavaScript resides in the Execute JavaScript Code workflow action

Let’s start off with the code snippet:
// 1. returns the 8th business day in the current month
return getNthBusinessDay(8, new Date());
// 2. n = business day we are looking for
// referenceDate = is the month in a specific year for which we want to check what the nth business day is
function getNthBusinessDay(nth, referenceDate, isSaturdayBusinessDay = false) {
if (nth <= 0) {
throw new Error("Not a correct business day!");
}
// start calculation on first day of the month
let date = new Date(referenceDate.getFullYear(), referenceDate.getMonth(), 1);
let businessDays = 0;
while (true) {
// is the day we are checking a holiday, a saturday or sunday?
// then it isnt a business day, continue to next day
if (isHoliday(date) || (!isSaturdayBusinessDay && date.getDay() === 6) || date.getDay() === 0) {
date.setDate(date.getDate() + 1);
continue;
}
// if it is a business day, increase business days until we reach the nth business day
// for that day return the date
if (++businessDays === nth) {
return date;
}
date.setDate(date.getDate() + 1);
}
}
function isHoliday(dt) {
//3. this function checks (based on the open holidays api http action), if a day is a holiday
var publicHolidays = workflowContext.actions.Get_public_holidays.outputs.body;
var dateString = new Date(dt.getTime() - (dt.getTimezoneOffset() * 60000 ))
.toISOString()
.split("T")[0];
var result = publicHolidays.find(holiday => holiday.startDate === dateString);
if(result) {
return true;
}
else {
return false;
}
}
1) The first line of code triggers the getNthBusinessDay function with
- the business day in a month we’re looking for. In the example I want to get the 8th business day of the month.
- and the current date. The rference date is needed to get the specific business day in a given month/year.
2) This is the main function that starts from the first day of a given month (current month) and just checks for each day if it is a business day (not a holiday and not a weekend day). If it isn’t a holiday or weekend day, it is considered a business day and the business day counter is increased and the logic moves to the next day in the given month. This continues to do so, until the given business day has been reached.
3) This function is a helper to check if a day in the month is a holiday.
- It uses the output of the previous API call to have an array of holidays for the year. var publicHolidays = workflowContext.actions.Get_public_holidays.outputs.body;
- It then checks if a given date, is one of the public holidays that are known and returns true/false.
So key takeaway is that this javascript snippet returns the date of the given business day.
4. An if condition to check current date against the date of the n’th business day
Last but not least, the final condition action checks the current date (utcNow) against the n’th business day date to determine if the run should be cancelled.

"equals": [
"@formatDateTime(utcNow(), 'yyyy-MM-dd')",
"@formatDateTime(outputs('Get_nth_business_day_in_month'), 'yyyy-MM-dd')"
]
The result
The workflow run starts each workday, but if the date isn’t the configured business day, it will just cancel without any further processing to happen.
And if the current dat is the n’th business day, the workflow will continue processing.

Closing
I have currently created this solution to check for a single business day and start processing when that day is met. Even though it’s basic functionality, you will need to build custom logic to get it to work.
My current solution checks for a particular business day in the month, but with some minor adjustments you could even check for multiple specific business days in a month!
Feel free to take the code as a basis and bring it to your next level, and thanks for the time you took to read this article!


Leave a Reply