How to create a custom field that calculates numbers?

Grace Caddle May 19, 2021

Hi there,

I am creating a request type that requires numbers to be entered into fields. 

I was wondering if there is a way to create a field that automatically sums numbers from another field. 

I tried looking into 'custom fields' but didn't get very far. I've attached a screenshot of what it would look like. 

Screen Shot 2021-05-20 at 10.42.33 am.png

3 answers

1 vote
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 20, 2021

Hi Grace,

You can use automation for Jira to update the issue and edit the variance field. The formula would look like this:

{{#=}}{{issue.customfield_16719}}-{{issue.customfield_17252}}{{/}}

where you would put the custom field ID for the Actual and Total Sales fields. 

Example:

screenshot.png

Grace Caddle May 20, 2021

Thanks for the suggestion. 

Is there a way to make this happen without an additional app?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2021

No, you need an app to do this, but the automation that John is describing is included in Cloud so you don't need to go find an app or enable anything.

Like John Funk likes this
Grace Caddle May 23, 2021

Hi @John Funk 

Am I on the right track? Screen Shot 2021-05-24 at 12.51.00 pm.png

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 24, 2021

So far so good - just make sure you get the right ID for each of your custom fields and that they are in the right order in your formula

Grace Caddle June 15, 2021

Hi @John Funk 

 

How do I find the right ID for the custom fields? 

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2021

If you go to any any custom field to edit it or view the context, the ID for the field will be included in the URL. 

screenshot1.png

Grace Caddle June 16, 2021

I am not sure that the fields I'm using are custom...would I have to make them custom for this to work? I created them as fields within the issue...but don't know where to find them under configure custom fields? I've attached a photo of what my screen looks like when I was editing the issue type.

 

I really appreciate your help on this! I'm a bit lost. Screen Shot 2021-06-17 at 1.59.14 pm.png

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 18, 2021

Ah, these are Team-managed custom fields. Therefore, you cannot get to them in the path I outlined as that is for Company-managed, shared custom fields. 

Your best bet is to just use the exact name of the custom field (including case) instead of the ID. So it would look like:

{{#=}}{{issue.Total}}-{{issue.Actual}}{{/}}

Grace Caddle June 23, 2021

Hi again,

I should note that I'm working under Jira Service Management, I'm not sure if that changes anything.

This is what I have so far in terms of the automation, I've taken screen shots at each step. When I've enabled it, it still doesn't seem to calculate automatically in the variance field. 

Screen Shot 2021-06-24 at 2.01.55 pm.pngScreen Shot 2021-06-24 at 2.02.02 pm.png

Screen Shot 2021-06-24 at 2.02.07 pm.png

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 24, 2021

That should work. How are you updating the Total field? Is it a manual entry on the screen? Or is it calculated in some other way? 

And can you share the results of the Audit log? 

1 vote
Yana Stoliarova May 19, 2021

I would probably use a ScriptRunner for this job. There is many samples for similar calculations in the Internet.

0 votes
Prince Nyeche
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.
May 19, 2021

Hi,

You can use automation to do this on the issue. Create the rule that will do the summation of both fields. Then update the 3rd field with the result.

Grace Caddle May 19, 2021

Thanks for your reply! 

I am new to Jira so I might need some more info on this...

Do you mean creating a rule under editing workflow?

Prince Nyeche
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.
May 19, 2021

No, I meant automation for Jira. You will need to learn about smart values.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events