Scott
Scott

Reputation: 63

UiPath Orchestrator Triggers - Cron Expression For specific day of month or next working day if not a working day

I've currently got this Cron expression that I'm using to trigger a process in UiPath Orchestrator:

0 0 15 21W * ? *

Runs on the closest working day to the 21st of each month at 3pm.

However I need it to run on the next working day at 3pm if the 21st is a non working day.

Tried searching for an answer and nothing quite fit the brief.

I used this website to build my expression (which is a great tool) but it only had an option for 'nearest day' and not next working day given a specific day of month: https://www.freeformatter.com/cron-expression-generator-quartz.html

Upvotes: 1

Views: 1718

Answers (3)

Javier Garcia
Javier Garcia

Reputation: 61

You can configure your trigger to launch oftener, then manage dates at init of your process, but you must set up a list of "holydays" or check in some way.

Also you can use the calendar option of orchestrator (+info)

Upvotes: 0

Alan
Alan

Reputation: 461

We have (had) the exact same issue. Since UiPath doesn't offer a feasible solution out of the box, we will work around the restriction using the following strategy: We trigger the actual job daily, considering a custom-built, static NonWorkingDay-list that will just suppress the execution of the robot every day we don't want it to run.

These steps are needed:

  1. Get a list with of all known bank holidays, saturdays and sundays until 2053 or so...

  2. Build a the static exclusion-list using a script that does something like this (pseudocode. I will update the answer once we have actually implemented the solution):

    1. get all valid execution dates
    loop through every 28th of the month until end of 2053
      if the date is in the bankHolidayList then
        loop until the next bankDay is found
          add it to the list of valid ExecutionDates
     else
        add the date to the validExecutionDate-list
    
    2. build exclusion-list
    loop through every day until end of 2053
      if the date is not in the validExecutionDate-list
        add it to the exclusionDate-list
    
  3. Format the csv accordingly and upload it to the orchestrator tenant as a NonWorkingDay-List

  4. Update your trigger to run daily at your desired time, using the uploaded NonWorkDay-Calendar

While the accepted answer will surely work as well, we prefered to go with this approach because having a separate robot that does nothing but executing a UiPath trigger just doesn't seem right to me. With this approach we have no additional code that we potentially need to maintain.

In my oppinion not having a solution for this concern out of the box is a lack of feature that UiPath will (hopefully) fix until end of 2053 ;-)

Cheers

Upvotes: 0

kwoxer
kwoxer

Reputation: 3833

As you don't need the nearest day, you can't use the functionality of Orchestrator cronjob. I would recommend creating a wrapper process as follows:

  1. Create a new process, let's call it StartJobByCheckingDate
  2. Now create a trigger that starts StartJobByCheckingDate each day at 3pm
  3. So that process is now your manager of your desired process
  4. Now we need to check if it is the 21th day
  5. Here you have different ways to solve it
    1. You could create a DataTable or even a file in the StartJobByCheckingDate process, that contains all the different days where your desired process should be fired (but this is very manual, you might not want to update this every year, so this might not be the smartest but the easiest solution)
    2. The other idea is to check if the current day is the 21th day. If so check if it is Saturday/Sunday (non-working day).
      • If true: you could now create a empty dummy file somewhere that tracks that the 21th was a non-working day, and the next day you check that file existing, if it exists you check the current day to be a working day, and if so you delete the file again and start your desired process
      • If false: just start your desired process directly

I think 2. idea would be that best. Sure you have 365 jobs runs/year. But when you keep that helper process smart this will just be seconds.

Another idea instead of using the dummy file, would be to use Entities. Smarter but need some more time to get familiar with.

Upvotes: 1

Related Questions