Skip to content

An easy way to work with Cron expressions in Salesforce. You can get and set each one of the terms in a Cron expression.

License

Notifications You must be signed in to change notification settings

sfdcjedi/sfdc-cron-expressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SFDC Cron Expressions

An easy way to work with Cron expressions. You can get and set each one of the terms in a Cron expression.

Starting from a complete expression, we can work with each of its terms. Also validates that our expression has the correct format.

View the story on Medium (Inglés)

Ver el artículo en Medium (Español)

Deploy to Salesforce

Metadata List

  • CronExpression.cls: Uility class to work with Cron expressions.
  • CronExpressionTest.cls: Test class with the unit tests of CronExpression

Example

CronExpression cronExp = new CronExpression('0 0 12 * * ?');

System.debug('Seconds: ', cronExp.getSeconds());
System.debug('Minutes: ', cronExp.getMinutes());
System.debug('Hours: ', cronExp.getHours());
System.debug('Days of Month: ', cronExp.getDaysOfMonth());
System.debug('Month: ', cronExp.getMonths());
System.debug('Day of Week: ', cronExp.getDaysOfWeek());
System.debug('Year: ', cronExp.getYears());
System.debug('Full Expression', cronExp.getStringExpression());

About

An easy way to work with Cron expressions in Salesforce. You can get and set each one of the terms in a Cron expression.

Topics

Resources

License

Stars

Watchers

Forks

Languages