Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Field = Field A + Field B * Field C

Humberto Gomes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 10, 2023

Hi,

 

Sorry for this post, 

Should be a very easy and basic question, but I don't know how to do it.

I have 3 number fields.

Let's call N1, N2, N3.

 

I need a new Number Field N4 with the value of:

N4 = N2 * N3 + N1

 

How can I do it?

Side note: I Have Script Runner installed just in case.

 

3 answers

3 accepted

0 votes
Answer accepted
Humberto Gomes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 11, 2023

The result is not needed to be present and be dynamic in the edit/creation screen.

Found this article:

Jira smart values - math expressions | Automation for Jira Data Center and Server 8.1 | Atlassian Documentation

 

Implemented as Automation, every time the source fields are edited.

Allow me to make an exclusion if some values are missing.

Story Points is not empty
RICE Score Reach is not empty
RICE Score Impact is not empty
RICE Score Confidence is not empty

 

do:

RICE Result: 

{{#=}} ({{issue.customfield_14208}} * {{issue.customfield_14209}} * ({{issue.customfield_14210}}/100)) / {{issue.customfield_10106}} {{/}}

0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 10, 2023

Do you need N4 to be editable by users after it has been calculated?  And kept up to date if N1, N2 or N3 are changed?

If not, then I'd use a scripted field for this.  This script at https://library.adaptavist.com/entity/populate-a-scripted-field-with-the-sum-of-all-values-added-or-updated-in-a-number-field is not a bad start, you can remove the stuff about change history, and add lines for getting the values of N2 and N3 and then do a simple calculation.

If you want to put the answer into a field, then you can combine that with writing the target field in https://library.adaptavist.com/entity/change-the-value-of-a-custom-field-in-a-post-function

0 votes
Answer accepted
Vamsi Kandala
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 10, 2023

Hi @Humberto Gomes

Are you looking for displaying the value of N4 at the time of creation of ticket or after the creation?

If it is after the creation of ticket, you can use automation rules or if you have 'Jira Workflow Toolbox' plugin installed, you can have the N4 as the custom field of 'Calculated Number Field' and specify the expression accordingly.

In case if you are looking for displaying the value at the time of creation of ticket, provided the values for all the three custom fields (N1, N2 and N3) are given by the user, you can use the script in ScriptRunner to display that.

Hope this helps.

Thanks,
Vamsi

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events