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,296,647
Community Members
 
Community Events
165
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

0 votes

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
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

327 views 0 10
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you