Crone expression to run on every month first saturday

Hello all,

Trying to write a crone expression for a bot that should run on first saturday of every month and 1st day of month should not be saturday.

If 1st day of month falls on saturday then bot should run on next saturday i.e on 8th.Saturday falling in the date range 2nd to 8th of each month

Thank you.

Try to see if

0 0 0 ? * 5#1 *

Wont do it. For future expressions, take a look at Free Online Cron Expression Generator and Describer - FreeFormatter.com or similar online services.

@Kavya_Mamidishetti2

Check below for your reference

Hope this will help you

Thanks

Thanks for the response but the start day(1st day) of month should not be saturday.
If 1st day of month is saturday then it should run on next saturday i.e on 8th.

UiPath Orchestrator depends on Quartz .NET Framework and unfortunately the conditional constraints you have are not within it’s capabilities.

0 0 0 2-8 * ? == At 12:00 AM, between day 2 and 8 of the month

0 0 0 ? * SAT == At 12:00 AM, only on Saturday

Or in the expression provided above doesn’t meet your requirements, but limits which Saturday

0 0 0 ? * SAT#1 == At 12:00 AM, on the first Saturday of the month

You cannot have both Day of the Month and Day of the Week configured, so unfortunately 0 0 0 2-8 * SAT#1 is not a valid expression

WARNING

Support for specifying both a day-of-week and a day-of-month value is not complete (you must currently use the ‘?’ character in one of these fields).

You can overcome this with a few options

  1. Define cron to run every 1st Saturday of the month, include logic in your workflow during init to gracefully end the job without processing if it is the 1st of the month.

  2. Define cron to run every 1st Saturday of the month. Leverage Orchestrator’s Non-working Day Calendars to exclude Dates where 1st == Saturday. (Long term this requires more effort to setup the calendar, but you could forecast it out a few years / generate the calendar record programmatically

  3. Define cron to run every day between the 2nd and 8th of the month, include logic in your workflow during init to gracefully end the job if it is not Saturday

https://www.quartz-scheduler.net/

2 Likes

Hi @Kavya_Mamidishetti2

As per @codemonkee’s post you cannot add conditions/logic within a cron expression so you won’t be able to achieve this with a single cron expression.

You have a few options but the cleanest might be just to insert some logic into your code at “Init” like the attached workflow.
Main.xaml (16.5 KB).

. THen you will need a cron (0 0 0 1,8 * ? *) to run on 1st day and 8th of the month.

Hopefully this helps :blush:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.