Forums

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

Automation to subtract two fields not working

Daryl Marsh January 29, 2025

Hello, I'm in the process of trying to create an automation that will give us visibility into how far off our teams estimates are from the actual time spent during development. Everything is working as expected, except the last step - isnt that always the case.

I have a custom field (customfield_10795) that is a text field that has the value of how many days the issue was in development. I want to take that value and subtract it from 'Story Points' and write that value to another custom text field.

Here is the smart value I'm using - {{issue.Story Points.minus(issue.customfield_10795)}}

Audit log says this was successful but never wrote to the custom text field.jira screengrab.PNG

The value that is currently returned is just the Story Points.

I've tried just about everything including swapping out minus for diff and using a 'number' field instead of a text field.

2 answers

0 votes
Richard Cho - ServiceRocket
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 29, 2025

@Daryl Marsh Try converting the text field to a number first using `asNumber` and see if that helps.

{{issue.Story Points.minus(issue.customfield_10795.asNumber)}}

 

Richard Cho - ServiceRocket
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 29, 2025

Also, I don't think you need that branch rule. Could probably simplify it to just this:

Screenshot_20250130_120215.png

Daryl Marsh January 30, 2025

adding 'asNumber' didn't change anything

 

0 votes
Trudy Claspill
Community Champion
January 29, 2025

Hello @Daryl Marsh 

As a debugging technique, with you FOR branch can you add a Log action to print out the two smart values you are trying to use:

{{issue.Story Points}}

{{issue.customfield_10795}}

This is to get confirmation that the fields contain the values that you expect. Please then share with us an image of the updated rule and the output in the audit log.

Daryl Marsh January 30, 2025

those numbers returned with the expected values - 

jira v1.PNGjira v2.PNG

Trudy Claspill
Community Champion
January 30, 2025

Your custom field returned text, not a number.

Screenshot 2025-01-30 at 2.02.28 PM.png

You can't use text in a math operation. 

It needs to contain only a number, or parse the field to get just the numeric content.

Since you have defined it as a text field, what other text might you place in that field? Do you expect it to always be "# days"? Could there be some other unit of measure, like hours or weeks?

Daryl Marsh January 30, 2025

It would always be days.

 

Trudy Claspill
Community Champion
January 30, 2025

Will it always be in the format?

# <space> days

 

Just curious, if the field is always going to contain a number of days why was it not created as a Number type custom field?

Daryl Marsh January 30, 2025

I'm not married to the text field. I will re-create it as a number type and report back.

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events