Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,467,417
Community Members
 
Community Events
177
Community Groups

Sum 2 number fields

Edited

Hi everyone. 

My question seems simple but I'm lost with script and automation so I would like some help if possible ...

I want to sum 2 number fields in a third field. It's limited to one Service Desk project and it's very basic. For example:

Field A = 1

Field B = 4

Total cost = 5 (sum of A + B)

How can I do it simply? 

Thank in advance for your help. 

1 answer

Hi, @Fabien GIQUIAUD !

Agree with you - it is possible using Scriptrunner,

Check the similar question, there you can fing a lot of examples.

Hi @Alexander Bondarev 

Thanks for the quick answer. Sorry I am new to scripts, I looked at the other question and tried to reproduce the script, but I have an error on the "+" symbol (I guess)

> Cannot find matching method java.lang.Object#plus(java.lang.Object)

This is what I put in:

 

import com.atlassian.jira.component.ComponentAccessor

def A = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Cost of training (€)")

def B = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Extra costs")

return issue.getCustomFieldValue(A) + issue.getCustomFieldValue(B)
P.S: I am on Jira server and not cloud

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events