Here is one approach to creating a holiday booking workflow that excludes weekends and bank holidays. The logic of this workflow is based on creating a collection variable containing the date range of the requested holiday dates, a collection containing the bank holidays and then checking these dates against each other to filter out the bank holidays. The key to this working is enforcing the date formats throughout the workflow.
STEP 1: Create a custom list called HolidayBooking with 2 date columns for DateStart and DateEnd. The end user will use the DateStart and DateEnd to define the duration of their holiday.
STEP 2: Create a list workflow on the HolidayBooking list with the following variables:
STEP 3: Create a collection called varColBankHol containing the bank holiday dates. These dates will eventually be excluded from the requested date range.
The Bank Holiday collection (varColBankHol) looks like this:
STEP 4: Add the start date and end date as variables.
STEP 5: Create a collection called varColRequestedDates containing the range of requested holiday dates ensuring they are formatted as dd/MM/yyyy. After the loop add the end date to the varColRequestedDates collection.
The resulting collection (varColRequestedDates) based on a start date of 27th May 2016 and an end date of 2nd June 2016:
We next need to filter out the weekends and bank holidays from this range. 28/05/2016 & 29/05/2016 are weekend dates and 30/05/2016 is a bank holiday.
STEP 6: Remove weekends from the varColRequestedDates collection of requested dates.
Value: fn-FormatDate(varDate1, "dddd")
does not begin with
The resulting collection (varColBusDates) with the weekend dates removed:
We removed 28/05/2016 & 29/05/2016 from the collection.
STEP 7: Now we have a collection variable containing a range of dates that excludes weekends. We now need to exclude bank holidays.
Workflow Data: varYNExists
Value: fn-FormatDate(varDate1, "dd/MM/yyyy")
Value: fn-FormatDate(varDateEnd, "dd/MM/yyyy")
The resulting collection (varColBusDates) with the bank holiday dates removed:
We removed 30/05/2016 from the collection.
We now have a collection of dates based on a date range specified by the user that excludes weekends and bank holidays.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.