Predefined variables

Time Zones in variables:

Cloud: If it’s scheduled execution, variables are interpolated using scheduled job's timezone (which is set while creating SJ). When it’s manual execution, user’s timezone is being used.

Server & Data Center: System timezone is always used (both in manual and scheduled executions)

The Scheduler has a feature of predefined variables which can be used in any text field. When Scheduled Issue is fired those variables are converted into corresponding values.

Most of the variables can be replaced through formatted usage of the formatted variables for created date ( ${createdDate.format("dd-MM-yyyy HH:mm")} ) and due date ( ${dueDate.format("dd-MM-yyyy HH:mm")} ). For ease of use, there are other variables which are more user friendly and easier to read. In table below you can see all currently available variables with hosting option visible.

Since Scheduler v6.4.3 for Server & Data Center - you can uses same variables as in Cloud version.

Legend: - available

- not available (additional information about replacement)

Variable

Cloud

Server (DC) >= 6.4.3

Server (DC) < 6.4.3

Meaning

Result

Variable

Cloud

Server (DC) >= 6.4.3

Server (DC) < 6.4.3

Meaning

Result

${fireCount}

Fire count, number of executions of Scheduled Issue

5

${createdDate}

${createdDate.format("yyyy-MM-dd HH:mm z")}

Creation date in format yyyy-MM-DD HH:mm timezone

2017-02-02 14:41 Europe/Warsaw

${createdDate.day}

${createdDate.format("dd")}

Creation day

2

${createdDate.month}

Creation month

February

${createdDate.shortMonth}

${createdDate.format("M")}

Creation month in number form

2

${createdDate.year}

Creation year

2017

${createdDate.date}

Creation date in format yyyy-MM-DD

02.02.2017

${createdDate.time}

${createdDate.format("HH:mm")}

Creation time in 24 hour format

14:41

${createdDate.timezone}

${createdDate.format("z")}

Creation date timezone

Europe/Warsaw

${createdDate.timezoneOffset}

${createdDate.format("Z")}

Creation date timezone as time offset

GTM+01:00

+0100 (for server version)

${createdDate.weekOfMonth}

Creation date week of month

2

${createdDate.weekOfWeekYear}

${createdDate.format("w")}

Creation date week of week-based-year

28

${createdDate.weekYear}

Creation date week-based-year (should be used with .weekOfWeekYear)

2017

${dueDate}

Due date in format yyyy-MM-DD

02.02.2017

${dueDate.day}

Due date day

2

${dueDate.month}

Due date month

February

${dueDate.shortMonth}

Due date month in number form

2

${dueDate.year}

Due date year

2017

${dueDate.weekOfMonth}

Due date week of month

2

${dueDate.weekOfWeekYear}

Due date week of week-based-year

28

${dueDate.weekYear}

Due date week-based-year (should be used with .weekOfWeekYear)

2017

${createdDate.nextDay}

Creation next day based on today

22

${createdDate.nextMonth}

Creation next month based on today

August

${createdDate.nextWeekOfMonth}

Creation next week of month based on today

5

${createdDate.nextWeekOfWeekYear}

Creation next week of week year based on today

31

${createdDate.nextYear}

Creation next year based on today

2021

${createdDate.previousDay}

Creation previous day based on today

20

${createdDate.previousMonth}

Creation previous month based on today

June

${createdDate.previousWeekOfMonth}

Creation previous week of month based on today

3

${createdDate.previousWeekOfWeekYear}

Creation previous week of week year based on today

29

${createdDate.previousYear}

Creation previous year based on today

2019

${dueDate.nextDay}

Due date next day

22

${dueDate.nextMonth}

Due date next month

August

${dueDate.nextWeekOfMonth}

Due date next week of month

6

${dueDate.nextWeekOfWeekYear}

Due date next week of week-based-year

31

${dueDate.nextYear}

Due date next year

2021

${dueDate.previousDay}

Due date previous day

21

${dueDate.previousMonth}

Due date previous month

June

${dueDate.previousWeekOfMonth}

Due date previous week of month

4

${dueDate.previousWeekOfWeekYear}

Due date previous week of week-based-year

29

${dueDate.previousYear}

Due date previous year

2019

${createdDate.nextShortMonth}

Creation next month in number form based on today

8

${createdDate.previousShortMonth}

Creation previous month in number form based on today

6

${dueDate.nextShortMonth}

Due date next month in number form

8

${dueDate.previousShortMonth}

Due date previous month in number form

6

${createdDate.completeDateTime}

${createdDate.format("dd/MM/yyyy h:mm a")}

Creation date in format dd/MMM/YY hh:mm

10/Feb/15 2:05 PM

${dueDate.completeDateTime}

Due date in format dd/MMM/yy hh:mm

10/Feb/15 2:05 PM

${createdDate.format("dd-MM-YYYY HH:mm")}

Creation date in custom format

10-02-2015 14:05

${dueDate.format("dd-MM-YYYY HH:mm")}

Due date in custom format

10-02-2015 14:05

According to the DateTimeFormatter Java Docs (which implements the ISO-8601 specification)

  • y (lowercase) is year

  • Y (uppercase) is 'week-based-year'.

More info: https://dev.to/shane/yyyy-vs-yyyy-the-day-the-java-date-formatter-hurt-my-brain-4527

 

For Cloud version since v2.5.3 Oct 21, 2019 we have added format options for ${createdDate} and ${dueDate}. To both of these variables add .format("") and inside "" use desired date format. eg. ${createdDate.format("dd-MM-yyyy HH:mm")} .

For Server version it is also available.

You can use patters specified here: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns 

Here you can see the example with quarters used in creation and due date: ${createdDate.format("'Q'Q.yyyy")} ${dueDate.format("'Q'Q.yyyy")}:

Additionally you can define your own date format using the last two variables - simply by replacing the dd-MM-yyyy HH:mm with the desired format. You can use following letters in date format:

Symbol

Meaning

Presentation

Examples

Symbol

Meaning

Presentation

Examples

G

Era designator

text

AD

C

Century of era (>=0)

number

20

Y

Year of era (>=0)

year

2007

y

Year

year

2007

x

Weekyear

year

2007

w

Week of weekyear

number

27

e

Day of week

number

2

E

Day of week

text

Tuesday; Tue

D

Day of year

number

189

M

Month of year

month

July; Jul; 07

d

Day of month

number

10

a

Halfday of day

text

PM

K

Hour of halfday (0~11)

number

0

h

Clockhour of halfday (1~12)

number

12

H

Hour of day (0~23)

number

0

k

Clockhour of day (1~24)

number

24

m

Minute of hour

number

30

s

Second of minute

number

55

S

Milisecond

number

978

z

Time zone

text

Pacific Standard Time; PST

Z

Time zone offset/id

zone

  • 0800; -08:00; America/Los_Angeles

Cloud example:

You can use variables from tables as shown below:

When the actual issue gets created, the result looks as follows:

Server example:

On the 2nd screen of the Scheduled Issue wizard, which is named "Set Issue Details" (1), there's a possibility to add above presented predefined variable, into the "Summary" and "Description" fields or Epic Name. In the below picture, I've presented a situation whee "fire count" (2) has been inserted into the "summary" and most of variables possible to enter I've placed in a table - it is possible to use it in "Visual" (6) mode. Left column contains variable meaning (3) and right (4) is a variable itself. In addition to that, the last row, marked in green contains customized own date format. After all was set, I've followed to the next screen by pressing "Next" (7) and saved newly created issue on the third, final screen.

The built-in validator checks and makes impossible to create a scheduled issue with wrong variable input (after pressing next you receive an error in such case, pointing to what's incorrect).

After scheduled issue execution, I've received an expected outcome:

All of the variables were successfully converted into desired values.


Predefined variables could be used in many ways, here is one of the complex usage examples allowing you to embed images (or link to some external resources), if you know the right pattern: Adding attachments to Scheduled Issues - workaround.

 

Feel free to tell us what topic should be covered: thescheduler@psc-software.atlassian.net