You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

On this page

Use case

Issues can easily be identified by using their issue key. But some use cases also might require some custom IDs, which e.g. contain the current year and a custom number.

(tick) This use case can perfectly be done using JWT's post functions in combination with project properties!


We will use project properties to store the current year and a custom number. With the help of the post functions, these two numbers will then be combined as ID and added to the issue on creation.


Configuration

Setting up the current year and the counter
Update fields

Target issue

Choose Current issue

Field

Choose Temporary text 1

Value

Choose Parser expression and enter the following expression in advanced parsing mode:

year({system.currentDateTime}, LOCAL)

Conditional execution

Enter the following expression:

year({system.currentDateTime}, LOCAL) != toNumber(projectProperty("currentYear"))

(info) This is needed for the configuration regarding the current year.

Set or create project property "counter"

Property

Enter:

counter

Value

Enter:

1

Action

Choose Create the property and assign the value

Conditional execution

Enter the following expression:

year({system.currentDateTime}, LOCAL) != toNumber(projectProperty("currentYear"))

(info) This way the counter will be reset to one, if the year changes e.g. from 2021 to 2022.

Set or create project property "currentYear"

Property

Enter:

currentYear

Value

Enter:

%{issue.temporaryText1}

Action

Choose Create the property and assign the value

Conditional execution

Enter the following expression:

year({system.currentDateTime}, LOCAL) != toNumber(projectProperty("currentYear"))

(info) This is needed for the configuration regarding the counter.

Writing the ID to the issue

Update fields

Target issue

Choose Current issue

Fields

Field

Choose the field you want to set with the ID

Value

Choose Parser expression and enter the following expression in advanced parsing mode:

projectProperty("currentYear") + "-" + substring("0000", length(projectProperty("counter")), 4) + projectProperty("counter")

Field

Choose Temporary text 1

Value

Choose Parser expression and enter the following expression in advanced parsing mode:

toNumber(projectProperty("counter")) + 1
Increasing the counter

Set or create project property

Property

Enter:

counter

Value

Enter:

%{issue.temporaryText1}

Action

Choose Create the property and assign the value