How to Get Last Working Day of the every month

Certified Senior Developer

Hi Team,

I need Last working Day date of every month as i need to start process for every month Last working day.

Let's say if i take Aug-2025 Month & its month end date is 31st & falls on Sunday but in my case process should trigger on 29th Aug which is a last working day.

I need dynamic approach so that it iwll pick last working date & start process.

prompt response really appreciated,Thanks

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Create a process model with a Timer Start Event set to run daily. Connect it to a Script Task that checks if today equals the last working day using below expression. Add an XOR Gateway that routes to your monthly process when isLastWorkingDay is true, or to an End Event when false. 

    By using this expression you can find last working day of every month.

    a!localVariables(
      local!lastDay: eomonth(today(), 0),
      local!dayOfWeek: weekday(local!lastDay),
      local!lastWorkingDay: if(
        or(local!dayOfWeek = 7, local!dayOfWeek = 1), 
        if(local!dayOfWeek = 7, local!lastDay - 1, local!lastDay - 2),
        local!lastDay
      ),
      local!lastWorkingDay
    )
    

Reply
  • 0
    Certified Lead Developer

    Create a process model with a Timer Start Event set to run daily. Connect it to a Script Task that checks if today equals the last working day using below expression. Add an XOR Gateway that routes to your monthly process when isLastWorkingDay is true, or to an End Event when false. 

    By using this expression you can find last working day of every month.

    a!localVariables(
      local!lastDay: eomonth(today(), 0),
      local!dayOfWeek: weekday(local!lastDay),
      local!lastWorkingDay: if(
        or(local!dayOfWeek = 7, local!dayOfWeek = 1), 
        if(local!dayOfWeek = 7, local!lastDay - 1, local!lastDay - 2),
        local!lastDay
      ),
      local!lastWorkingDay
    )
    

Children