On this page

Use case

In this example, a custom identifier "Approval Code" is added to issues by using a project property and different custom fields.

The code that will be created is a combination of a specific number (sequence number), the fiscal year (custom field), and the abbreviation of a department.

Configuration items needed:

  • Project property "sequenceNumber"
  • Custom Text Field "Department"
  • Custom Text Field "Fiscal Year"
  • Custom Text Field "Approval Code"


The final approval code might look something like this:

2021/DEV/023

Prerequisites

In order to make this use case working, the project property sequenceNumber has to be set initially.

Set up the project property

Head over to the project you want to create the project property in.

Head over to Project settings → Details

Add the following text to the project description:

{sequenceNumber=1}


Configuration

Set the approval code

Add the Update or copy field values post function to the desired transition or create a new transition.

Target issue

Choose Current issue

Fields

Field

Select the field you want to write the approval code to.

Value

Choose Set field value manually

Expression

Add the following expression with mode set to Advanced text:

%{issue.cfaaaaa} + "/" + toUpperCase(substring(%{issue.cfbbbbb}, 0, 3)) + "/" + substring("000", length(projectProperty("sequenceNumber")), 3) + projectProperty("sequenceNumber")
more info...

The following field codes are used:

  • %{issue.cfaaaaa} is the field code for the field Fiscal year.
  • %{issue.cfbbbbb} is the field code for the field Department.


The department will be returned in the following format:

Value in field "Department"Value returned by the expression
DevelopmentDEV
SalesSAL
MarketingMAR

The expression will only grab the first three letters and write them in upper case by using substring() and toUpperCase().


In our case we want the sequenceNumber to be a 3-digit number. Therefore the following expression is used:

substring("000", length(projectProperty("sequenceNumber")), 3)

It takes the length of the sequenceNumber and dynamically adds zeros to fill up the sequenceNumber to a 3-digit number.

Example:

"sequenceNumber" project propertyAdded zerosOutput
12001
101010
1000100

The used functions are substring()length() and projectProperty().

The final approval code might look something like this:

2021/DEV/023

Field

In addition, select the Temporary number 1 field.

Value

Choose Set field value manually

Expression

Enter the following expression:

toNumber(projectProperty("sequenceNumber")) + 1

Update the "sequenceNumber" project property

Add the Set or create JWT project property underneath the previous post function.

Mode

Choose Create the property and assign the value

Property key

Enter

sequenceNumber

Property value

Enter

%{issue.temporaryNumber1}


Screenshots



If you still have questions, feel free to refer to our support team.