Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Page properties
hiddentrue


Tech review

Status
colourGreen
titledone

Style guide

Status
colourGreen
titledone

Page status

Status
colourGreen
titlecomplete

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged



Panel

On this page

Table of Contents
maxLevel2
exclude(On this page|Use case).*
stylecircle
typeflat
separatorpipe



UI Text Box
sizemedium
typeinfo

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.

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 an ID and added to the issue on creation.


UI Text Box
typetip

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




Prerequisites

UI Text Box
typeinfo

To get this use case working, several post functions are needed to set up the configuration.


UI Expand
titleSetting up the project property "currentYear"


UI Steps


UI Step

Add the Update or copy field values post function to the create transition of the desired workflow.


UI Step

Target issue

Choose Current issue


UI Step

Field

Choose Temporary number 1


UI Step

Value

Choose Parser expression and enter the following expression in numeric mode:

Code Block
languagebash
linenumberstrue
year({system.currentDateTime}, LOCAL)


UI Text Box
typeinfo

By using the year() function, we are grabbing the year part from the current date.

For further information, take a look at the year() function page.



UI Step

Conditional execution

Enter the following expression:

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


UI Text Box
typeinfo

The conditional execution is needed so that we only update the currentYear property, if the year changed (see below).



UI Step

Add the Set or create JWT project property post function to the transition.


UI Step

Property

Enter:

Code Block
currentYear



UI Step

Value

Enter:

Code Block
languagebash
linenumberstrue
%{issue.temporaryNumber1}



UI Step

Action

Choose Create the property and assign the value


UI Step

Conditional execution

Enter the following expression:

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


UI Text Box
typeinfo

Like above, we only want to execute this post function (and update the project property), if the current year is different to the one saved in the project property currentYear.





UI Expand
titleSetting up the project property "counter"


UI Steps


UI Step

Add the Set or create JWT project property post function below the previously created post functions.


UI Step

Property

Enter:

Code Block
counter



UI Step

Value

Enter:

Code Block
languagebash
linenumberstrue
1



UI Step

Action

Choose Create the property and assign the value


UI Step

Conditional execution

Enter the following expression:

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


UI Text Box
typeinfo

This way the counter will be reset to 1, if the year changes e.g. from 2021 to 2022.






Configuration

UI Steps

Writing the ID to the issue

UI Step

Add the Update or copy field values post function underneath the created post functions.


UI Step

Target issue

Choose Current issue


UI Step

Fields

UI Steps


UI Step

Field

Choose the field you want to set with the ID


UI Step

Value

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

Code Block
languagebash
linenumberstrue
projectProperty("currentYear") + "-" + substring("0000", length(projectProperty("counter")), 4) + projectProperty("counter")


UI Expand
titlemore info...


UI Text Box
typeinfo

In our use case, we want to set the current year combined with a 4-digit number as ID.

The expression

Code Block
linenumberstrue
substring("0000", length(projectProperty("counter")), 4)

takes the length of our counter and dynamically adds zeros to fill up the counter to a 4-digit number.

Example:

"counter" project propertyAdded zerosOutput
130001
1020010
10010100
100001000







UI Step

Field

In addition, select Temporary number 1 field.


UI Step

Value

Choose Parser expression and enter the following expression in numeric mode:

Code Block
languagebash
linenumberstrue
toNumber(projectProperty("counter")) + 1


UI Text Box
typeinfo

We increase the Temporary number 1 by 1 to increase the counter project property (see below).




UI Steps

Increasing the counter

UI Step

Add the Set or create JWT project property post function.


UI Step

Property

Enter:

Code Block
counter



UI Step

Value

Enter:

Code Block
languagebash
linenumberstrue
%{issue.temporaryNumber1}



UI Step

Action

Choose Create the property and assign the value




Screenshots


Related use cases

Page properties report
firstcolumnUse case
headingsJWT feature, Workflow function, Parser functions, Label
cqllabel = "use-case-workflow" and ancestor = "27066660"


Excerpt Include
DECADIS:Contact support
DECADIS:Contact support
nopaneltrue


Page properties
hiddentrue