Forums

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

Jira smart values for custom field: calculate and log work not working

toannv26
December 14, 2025

I define a rule to auto log work when user change effort value.

Step 1: Calculate the diffday difference when the developer actual effort field (customfield_19616) changes by subtracting the old value (stored in the customfield_10303 field.because fieldchange.from.value cannot be used). The unit of this field is days.

smart values:
{{#=}}{{issue.fields.customfield_19616.diff(issue.fields.customfield_10303).abs}}{{/}}

rule.png

Step 2: Convert diffday to hours and store it in the log work field.
smart values: {{#=}}{{diffday}} * 8{{/}}h


logwwork.png

Step 3: Store the value of the developer actual effort field in the program_id field to calculate the difference next time.

Smart Value:
{{issue.fields.customfield_19616}}

programid.png

I try many way but seem it not work. This log show bellow
I'm using Jira v9.12.10


log.png

Please help me

2 answers

0 votes
Duc Thang TRAN
Contributor
December 15, 2025

Hello @toannv26 

Can you try this smart value if you need diff business days ?
{{#=}}{{issue.fields.customfield_11206.diff(issue.fields.customfield_11256).businessDays.abs}}*8{{/}}

If only need diff day

{{#=}}{{issue.fields.customfield_11206.diff(issue.fields.customfield_11256).days.abs}}*8{{/}}

Hope this can help

toannv26
December 15, 2025

customfield_19616 type float, customfield_10303 type text
It not a date field. So I think .days or .businessDays will not working

0 votes
Trudy Claspill
Community Champion
December 14, 2025

Hello @toannv26 

Welcome to the Atlassian community.

I suspect there may be a problem with your use of the diff function in the math expression you use when creating your {{diffday}} variable.

Can you add a Log action after creation of that variable to log the value of it?

Screenshot 2025-12-14 at 9.58.33 PM.png

I suspect this is the case because no value is being shown for the variable in the error message in your log. Instead it is detecting the "*" as the first character in that match expression.

Screenshot 2025-12-14 at 10.01.56 PM.png

 

I think instead of the diff function you need to use the unary minus operator to subtract one value from the other.

Disclaimer: I don't have a Data Center environment where I can test this out, so this is an untested recommendation.

toannv26
December 14, 2025

@Trudy Claspill Thank you for your support. I think you are right about diff value issue. I change to minus operator but it still not working
Screenshot 2025-12-15 131728.png

diff.png

Trudy Claspill
Community Champion
December 15, 2025

What are the custom fields types for 19616 and 10303?

Consider logging the values of those fields, and the math expression from your Create Variable, into the audit log to see if you are getting the expected values

toannv26
December 15, 2025

@Trudy Claspill 
customfield_19616 type float, customfield_10303 type text
I try to convert text tonumber but not working


{{#=}}{{issue.fields.customfield_19616 - issue.fields.customfield_10303.asNumber}}{{/}}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events