On this page

Features used to implement the examples

Example 1: Due Date should be at least 5 workdays posterior to Creation Date and Time

We want to ensure that "Due date" is at least 5 workdays later than issue date and time of creation. To do it we use validator Boolean validator with math, date-time or text-string terms with the following configuration:

Boolean expression used is: {00012} >= addDaysSkippingWeekends({00009}, 5, LOCAL) 

Note that:

  • {00012} is code for numeric value of "Due date"
  • {00009} is code for numeric value of "Date and time of creation"
  • LOCAL represents server's timezone. Timezone is needed to determine weekend time periods. Use USER_LOCAL for using current user's timezone

Once configured, the transition "Create Issue" will look like this:

Example 2: Define a time frame where transition execution is allowed

We want to allow the execution of a transition only Mondays to Thursdays: from 9:00 to 14:00 and from 17:00 to 20:30.

We can use Boolean condition and validator with math. date-time or text-string terms condition or validator depending on whether we want to hide the transition, or show a custom error message to the user when transition execution was not done in a valid time frame. In this example we are going to use the validator:

Boolean expression used is: dayOfTheWeek({00057}, LOCAL) >= {MONDAY} AND dayOfTheWeek({00057}, LOCAL) <= {THURSDAY} AND (timePart({00057}, LOCAL) >= 9:00 AND timePart({00057}, LOCAL) <= 14:00 OR timePart({00057}, LOCAL) >= 17:00 AND timePart({00057}, LOCAL) <= 20:00)

Note that:

  • {00057} is code for numeric value of "Current date and time"
  • LOCAL represents server's timezone. Use USER_LOCAL for using current user's timezone

Once configured, the transition will look like this:

Calculation Using Custom Schedules

Since version 2.2.39 time calculations on custom defined schedules can be carried out using Schedules Definition Grammar.

For example, you can define your work-schedule as Mondays to Fridays from 8:00 to 15:00, and from 16:00 to 20:00. Then you can calculate time differences, or add time durations to a base instant within that particular custom schedule.

Much more complex schedules than the one described in the example above are possible. You can define common and personal holidays, you can define different work-times for summer and winter seasons, change your work-times from a certain date on, keeping the older work-time definitions for previous instants. Almost any requirement you might think of is possible.

Other examples of that function

Related Usage Examples