Example: Implement a form with a series of questions and calculate a numeric value based on the answers
I need assistance in adding a value to a text field based on the option selection. I am building out a change management form in Jira and there are a series of questions that is being created via custom fields. Based on the option selected for the custom field, each field needs to be given a value of 1, 2, 3, or 4 (hidden values) and then I need to add a field value showing the Impact Rating result total (sum of the hidden values).
Example:
I created a custom field – Change in Software Release (new version)?
The option is set to - Yes or None
If Yes is selected, then I need to give the field a value of 4
This use case can be implemented using Mathematical and date-time expression calculator post-function with a formula similar to this one:
(%{aaaaa} = "Yes" ? 4 : 0) + (%{bbbbb} = "Yes" ? 1 : 0) + (%{ccccc} = "Yes" ? 2 : 0) + (%{ddddd} = "Yes" ? 4 : 0)
where aaaaa, bbbbb, ccccc and ddddd are field codes for custom fields that contain the answers to the questions, and 4, 1, 2 and 4 are the values to the questions when the answer is "Yes".
You should select Impact Rating as target field, which should be a numeric custom field.
If you had questions with more than 2 options as possible answers, you would have use a formula like this one:
(%{aaaaa} = "Yes" ? 4 : 0) + getMatchingValue(%{bbbbb}, ["Yes", "No"], [3, 0]) + getMatchingValue(%{ccccc}, ["Yes", "Sometimes", "Almost Never", "Never"], [4, 3, 1, 0]) + getMatchingValue(%{ddddd}, ["Blue","Red", "Green", "Other colors"], [4, 3, 2, 1])
Other examples of that function
- Automatic work log with start and stop work transitions
- Automatically log work time when the user uses a "Stop Progress" transition
- Calculate the time elapsed between 2 transition executions
- Getting the number of selected values in a custom field of type Multi Select
- Implement a form with a series of questions and calculate a numeric value based on the answers
- Increment a field or set to 1 if it's not set
- Set "Date-Time Picker" custom field with current date-time
- Set "Due date" 6 natural days (or work days) earlier than a "Date Picker" custom field
- Set "Due date" to a specific day of next week no matter of date of creation this week
- Set "Due date" with certain time offset from current date
- Set "Total time spent" to "Current date and time - date and time of last update"
- Set a custom field "Urgency" depending on a combined value of issue's priority and "Impact" custom field
- Sum "Time Spent" in all sub-tasks of issues linked with issue link types "LinkA", "LinkB", "LinkC"
- Triage Jira Service Desk email requests (Move issues)
- Using project properties to calculate custom sequence numbers