Calculated Number field

Please see the calculated number field we need written below. I would love some help in writing the script to accomplish what we would like to accomplish. Column A (A-G) are the fields. Columns B-F are the options that can be entered for the given field. And the last row (Total Marks in Category) is multiplied by a given number depending upon what is entered as an option for the given field. Please let me know if there are any questions.

9 answers

Here is a zommed in version of the original image I included.

0 votes

What are you planning to use to calculate this?

I did some research and downloaded this add-on which allows you to use a "Calculated Number Field"

You could also try Script Runner, there is an example of the principal of what you are trying to do here:

Here is what I have so far for the calculated number field. Can someone please take a look and help me out with this?

<!-- @@Formula:

issue.get("customfield_13603") != null ?

if (value === 6)

return (value * 2);

if (value === 7)

return (value * 2);

if (value === 8)

return (value * 2);

if (value === 9)

return (value * 2);

if (value === 10)

return (value * 2);


0 votes

Hey Campbell,

We just spoke on the phone. Regarding your questions about the Calculated Number Field custom field from the JIRA Misc Custom Fields, you can get further help from Innovalog's Support team please see this Getting Support page. :)


I have just edited your question to add this add-on's tag so that the Innovalog team can see it.

As of now I am only worrying about Field A (Eventually we are going to create Fields B-G). So let's just say I have created 1 custom field for now. This field is a radio button field with 5 options: 0, 1-5, 6-10, 11-15, and 16-100). The 1's in the cells mean that the user is selecting one of these options. I understand the 1 can be confusing (I didn't create the spreadsheet), so I would just think of it is a checkbox.

If O understand correctly, you have created 7 custom fields on your issues, named "A" to "G". What is the field type of these fields?

Also, I don't understand your Excel spreadsheet. What do the "1"s in the cells mean? I would assume that your fields are of type "Select", and you have created possible values equal to "0 (default)", "1-5", etc. Right? And thus the user can select a value for each field?

You might want to try something like:

Option val = issue.get("customfield_13603")
if (val == null)
  return null;
if (val.getValue().equalsIgnoreCase("0 (default)"))
  return 0;
if (val.getValue().equalsIgnoreCase("1 - 5"))
  return 1;

Thanks David for getting back to me. I have entered in what you have suggested and nothing is being populated into the field. I am not sure what is wrong because there are no error messages or anything.

Did you look into your logs for errors? Try displaying the issue with the field and then immediately look at the log. It should tell you if you have a syntax error.

Great, thanks. Can you let me know where exactly in the logs I should be looking?

Any time you try to actively use the field. Best thing to do is have a browser and a terminal open next to each other on your computer.

On the terminal, be tailing the log, so you're seeing it as Jira writes to it.

In the browser, edit an issue on-screen.

Any output the field throws into the log will be instantly echoed. (I've used the "edit" action as it's the most llikely to get the field's code to be called)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,177 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you