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.
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")
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 |
---|---|
Development | DEV |
Sales | SAL |
Marketing | MAR |
The expression will only grab to first 3 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 property | Added zeros | Output |
---|---|---|
1 | 2 | 001 |
10 | 1 | 010 |
100 | 0 | 100 |
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
Related use cases
Use case JWT feature Workflow function Parser functions Label Assign issue to the default user of a role Calculate custom sequence numbers Set custom IDs for each issue
If you still have questions, feel free to refer to our support team.