Features used to implement the example
- Project Properties
- Read a project property
- Mathematical and date-time expression calculator
- Update issue fields
- Set or create project property
Example: Using project properties to calculate custom sequence numbers
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 abbreviation of a department and will look like this:
003/2018-2019/DEV
Configuration items needed are:
- Project property "sequenceNumber"
- Custom Text Field "Department"
- Custom Text Field "Fiscal Year"
- Custom Text Field "Approval Code"
Setting the project property
Setting a project property can be done via the project settings → Details.
A valid expression is: {sequenceNumber=0}
Adding multiple post functions
When executing the transition, the current value of "sequenceNumber" is stored in an ephemeral field with the Read a project property post function.
Name of project property is: sequenceNumber
Ephemeral fields are temporary fields that can be used within a transition, e.g. to cache temporary values. They're cleared when the transition is completed, unless a Inhibit ephemeral fields auto-clearance post function is added to the transition.
Incrementing the "sequenceNumber" by one is done with a Mathematical and date-time expression calculator post function.
Formula is: {00058} + 1
Note that:
- {00058} is the field code for Ephermeral Number 1
Formatting the "sequenceNumber" is done with a Set a field as a function of other fields post function: This ensures that the sequence number is always a 3 digit number, e.g. "3" is formatted to "003" and "10" to "010".
Setting rules are:
[length(%{00058}) = 1]00%{00058}
[length(%{00058}) = 2]0%{00058}
[true]%{00058}
Note that:
- %{00058} is the field code for Ephemeral number 1
Finally, the "Approval Code" is composed with an Update issue fields post function.
Text to be parsed (in advanced mode) is: %{00061} + "/" + %{10420} + "/" + toUpperCase(substring(%{10421}, 0, 3))
Note that:
%{00061} is the field code for Ephermeral string 1
- %{10420} is the field code for custom text field "Fiscal Year" (this field code might differ on your instance)
- %{10421} is the field code for custom text field "Department" (this field code might differ on your instance)
In order to keep the "sequenceNumber" in sync, a final Set or create project property post function is added.
Once configured, the transition will look like this:
When executing this transition, the custom fields "Fiscal Year" and "Department" must not be empty! Ensuring this can be done by using a validator.