Condition in Cron Expression Possible?

Hi All,

Can we do conditioning in crown expression?
This means I have scheduled to run the bot on the 5th day of the month. if it falls on the weekend can I run a working day before which will be Friday on the 4th of the month? if not possible how to deal with this scenario.

Thanks in Advance

I don’t think this is possible at this time (but I’m sure someone will correct me if it is).

In the meantime, I’ll let our team know and they will look into it.

1 Like

Hi @vboddu @loginerror,

I read up a little on Uipath Documentation for cron jobs, but I dont think what you asked is currently “entirely” possible. Let me explain.

The closest expression I could write to meet your condition with the v2020.4 is:
0 0 0-6 5W# * ?
Between 12:00 AM and 06:59 AM, on the weekday nearest to day 5 of the every month.

The above expression suits your requirement if the 5th of month is a Saturday, then the job will run on the 4th, which will be a Friday.

The challenge however is if the 5th of a month is a Sunday, your process will only run on Monday the 6th. Because the W parameter looks for the nearest weekday, which will of course be the (the next day), Monday. The W parameter was something new to me and have not used it myself before in Linux.

I tried the above expression in orchestrator cloud community edition, seems to work!

Extras!

  • I tried to find out if the v2020.10 has some updates on Cron jobs, I dont see it in the beta-previews.

  • This exact particular problem is solved in linux forums, but I am not entirely sure how UiPath/ Quartz.NET have implemented the cron expression.

2 Likes

Thanks for the super info. This will not work for me if bots run next Monday as it will be a monetary loss

Please update to uipath team to implement in the new version or at least in triggers we have option not to run non-working days. if we have the option to run based on the calendar we upload it will be easy. This is quite a requirement for most of the scenarios in the supply chain, insurance, and finance.

Hi @vboddu - May be you can schedule to run the process on 3rd,4th and 5th of every month. In workflow,

  • check if date is 3rd and day is Friday then proceed, else do nothing but just set some flag in asset/queue.
  • check if date is 4th and day is Friday then proceed, else do nothing but just set some flag in asset/queue.
  • check if date is 5th and day is weekday/check the flag then proceed.

Cron expression - 0 0 10 3,4,5 * ? *

At 10:00:00am, on the 3rd, 4th and 5th day, every month

yes this is additional logic should be in code which I am aware. we have around 20 bots runs for 10 mins on each day of the month each bot has sep requirement to run on particular data. so it it has condition in schedule it would save lot of efforts