I am using 2 formulas to summarize number fields and display a total:, but neither one of them work to display the Total field:
<!-- @@Formula: (Integer.parseInt(issue.get("customfield_12919")) != null ? Integer.parseInt(issue.get("customfield_12919")) : 0)
+ (Integer.parseInt(issue.get("customfield_12920")) != null ? Integer.parseInt(issue.get("customfield_12920")) : 0)
+(Integer.parseInt(issue.get("customfield_12921")) != null ? Integer.parseInt(issue.get("customfield_12921")) : 0)
+(Integer.parseInt(issue.get("customfield_12922")) != null ? Integer.parseInt(issue.get("customfield_12922")) : 0)-->
<!-– @@Formula:(issue.get(“customfield_12919”) != null ? issue.get(“customfield_12919”) : 0)+(issue.get(“customfield_12919”) != null ? issue.get(“customfield_12919”) : 0)+(issue.get(“customfield_12920”) != null ? issue.get(“customfield_12920”) : 0)+(issue.get(“customfield_12921”) != null ? issue.get(“customfield_12921”) : 0)+(issue.get(“customfield_12922”) != null ? issue.get(“customfield_12922”) : 0)
-->
The formula should be the second one you posted:
<!-- @@Formula:
return (issue.get("customfield_12919") != null ? issue.get("customfield_12919") : 0)
+(issue.get("customfield_12920") != null ? issue.get("customfield_12920") : 0)
+(issue.get("customfield_12921") != null ? issue.get("customfield_12921") : 0)
+(issue.get("customfield_12922") != null ? issue.get("customfield_12922") : 0);
-->
if they are all Number type custom fields. I don't see any reason why it would not work - unless of course you didn't put the formula in the field's description.
Note that I had to fix the double quotes, which were not regular double quotes in your code snippet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, without access to the Jira logs, there isn't much you can do to figure out why this formula is not working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just received the log file, but was not able to find any exception or other error associated with this action... is there any specific message, or keyword?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to make sure you put the formula in the right place, try replacing the while formula with just "1":
<!-- @@Formula: 1
-->
and see if you see the value for the field. If not, it means you put this HTML comment in the wrong place. Are you creating a Calculate Numer Field? Are you putting the code in the description of that field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you look for errors inside theJira logfile (atlassian-jira.log)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fair enough.
Both of your formula are incorrect, but I can try to give you a working one.
What is the type of each custom field you're referencing in the formula?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.