Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,366,075
Community Members
 
Community Events
168
Community Groups

Add Issue Score for Jira by calculating choice fields

This workaround is meant to help projects where it is necessary to calculate text fields linked to numeric variables for the sum of a score. In this documentation, I used ProForma with Automation For Jira(A4J). Also, I used as an example a form related to a questionnaire on basic health care and in which it calculates a score for each section and at the end makes a total sum. This method can be used for other purposes (eg. true or false test).

Important related documentation:

Building Forms in ProForma
Working with Service Projects
Working with Software & Business Projects
ProForma & A4J
How AFJ works
Smart values

Workaround steps:

  • Form settings:

    • It will need to link all form fields to custom Jira fields (this is necessary for the A4J to be able to get the answers from the fields):Screen Shot 2021-10-13 at 17.00.23.png
    • And it’s will be necessary to leave the form open on issue creation (this is necessary for have an communication between ProForma and the A4J):Screen Shot 2021-10-13 at 17.05.36.png
  • A4J settings:
      • It’s only possible to trigger this automation rule by an 'Issue transitioned' status, another one will doesn’t work because of a time limitation between ProForma and A4J:Screen Shot 2021-10-13 at 17.14.52.png
      • Specify which issue type the automation rule will work. Using Smart Values it’s possible to calculate the options selected by a customer and made the sum of them (also note the defined Re-fetch actions):Screen Shot 2021-10-13 at 17.24.26.png
      • So the icing on the cake for calculating text fields options like 'Yes' or 'No' it’s here:
        {{#=}}IF({{issue.customfield_XXXXX.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_XXXXX.value.endsWith("Yes")|false}}{{/}}
      • In the edit logs I used three for calculating the values of the section and one for sum the total:

        - First section:
        {{#=}}IF({{issue.customfield_10062.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10063.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10064.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10065.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10066.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10067.value.endsWith("Yes")|false}}, 1, 0){{/}

        - Second section:
        {{#=}}IF({{issue.customfield_10068.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10069.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10072.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10073.value.endsWith("Yes")|false}}, 1, 0){{/}}

        - Third section:
        {{#=}}IF({{issue.customfield_10075.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10076.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10077.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10078.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10079.value.endsWith("Yes")|false}}, 1, 0)+IF({{issue.customfield_10080.value.endsWith("Yes")|false}}, 1, 0){{/}}

        - Total sum:
        {{#=}}{{issue.customfield_10071}}+{{issue.customfield_10074}}+{{issue.customfield_10081}}{{/}}
        Note: To find the custom field ID please take a look at this documentation. Also, the values 1 and 0 can be changed for any value that you wish.
      • This workaround will work as shown in the screen recording below (note that it will always be necessary to refresh the page to give A4J enough time to execute the automation rule):

0 comments

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events