Skip to main content
28/31

SLA Due Date That Skips Weekends and Holidays

Medium

A case must be answered within a number of working days. Given ri!startDate, ri!businessDays (1 or more) and ri!holidays (a list of dates, possibly empty), return the due date.

  • The start date itself is not counted: the first working day after it is day 1.
  • Saturdays, Sundays and any date in ri!holidays are not working days.

The calendar functions that do this for you are banned here: workday(), networkdays(), calworkdays(), calisworkday() and caladddays(). Build it from weekday() and list functions.


Why it comes up: in a real app, workday(ri!startDate, ri!businessDays, ri!holidays) does this in one call. Building it yourself practises a pattern you need often in Appian, which has no while loop: list more dates than you need, filter out the ones that don't count, and take the Nth.

Restrictions

Solve this without using workday(), networkdays(), calworkdays(), calisworkday() or caladddays().

ri! Rule Inputs

ri!startDateDate
date(2026, 11, 16)
ri!businessDaysInteger
3
ri!holidaysList of Date
{}

Example 1: Monday plus three days

Input: ri!startDate
date(2026, 11, 16)
Input: ri!businessDays
3
Input: ri!holidays
{}
Expected output:
date(2026, 11, 19)

Example 2: Friday rolls over the weekend

Input: ri!startDate
date(2026, 11, 20)
Input: ri!businessDays
1
Input: ri!holidays
{}
Expected output:
date(2026, 11, 23)

Example 3: Two holidays then a weekend

Input: ri!startDate
date(2026, 11, 25)
Input: ri!businessDays
2
Input: ri!holidays
{
  date(2026, 11, 26),
  date(2026, 11, 27)
}
Expected output:
date(2026, 12, 1)

Example 4: Starting on a Saturday

Input: ri!startDate
date(2026, 11, 21)
Input: ri!businessDays
5
Input: ri!holidays
{}
Expected output:
date(2026, 11, 27)

Example 5: Holidays on both sides of a weekend

Input: ri!startDate
date(2026, 12, 24)
Input: ri!businessDays
3
Input: ri!holidays
{
  date(2026, 12, 25),
  date(2026, 12, 28)
}
Expected output:
date(2026, 12, 31)

Appian Expression Tips

  • • Use ri!variableName for rule inputs
  • • Use a!localVariables(local!x: …, body) for locals
  • • Use a!forEach(items: …, expression: fv!item) to iterate
  • • Use where() / reject(fn!isnull, list) to filter