When creating a process that needs to start on a specific date or time in Creatio, you’ll use the Timer start element. This timer start includes some predefined start options for starting the process on a specific day, week, month, day of month, day of year, etc. However, what if you need things more specific than that? What if you want to make sure the process starts on a specific day, but only if it’s a weekday, not a weekend? Luckily, you can use CRON expressions to control the specifics of when the process needs to start when the pre-defined options aren’t specific enough.
In Creatio, scheduled processes (using a timer start) use the Quartz scheduler. One of the most powerful parts of the Quartz scheduler is the ability to use CRON expressions. A CRON expression is a combination of values representing seconds, minutes, hours, days, months, years with some other values that can be used for wildcards, and values that represent, first day of month, last day of month, weekdays, weekends, nth day, etc. It’s pretty powerful, but not always easy to understand the expressions. In fact, when you select some of the predefined intervals for the timer start, it’s actually creating a CRON expression for you. The full documentation of CRON expressions can be found here, however, it might still be hard to know how to put the expression together.
This is what a CRON expression looks like:
Every 3 days at 9 AM
0 0 9 */3 * ? *
Every Mon, Wed, Fri at 10:30 AM
0 30 10 ? * 2,4,6 *
The 20th day of the month at 2 PM
0 0 14 20 * ? *
The weekday closest to the 15th at 10:30 AM
0 30 10 24W * ? *
Every month on the first Monday of the Month, at noon
0 0 12 ? * 2#1
As you can see, they might not seem too intuitive to create from scratch. However, there is a tool online that can make creating these CRON expressions easy. Plus, the CRON expressions created by this tool will 100% work with the Quartz scheduler, meaning they will work with the Creatio start timer.
This tool will give you a UI, with all possible options. As you select the options you want, it will create the CRON expression for you. Then, you can add a start timer to your process, change the “Frequency of the process” option to “Other frequency” and paste in the CRON expression. The timer UI in Creatio will even then interpret the expression and give you back plain text describing what the CRON expression means:
Using a CRON expression for your process start timers might seem a bit daunting at first, but can provide you with complete control and flexibility of when your process will run.