Forums

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

Calculating using 2 custom fields (date time)

Deleted user December 16, 2021

Hi,

Due to some backlogs, there is a need for us to input incident start time and end time for the previous incidents. I have created 2 custom fields for this.

Im thinking about adding another custom field (incident duration) and the computation of 2 custom fields (start and end time) would be calculated and appear on that duration field.

Is there a way to do this without installing an app/plugin? I have done the following:

1. Through SLA - cannot choose the custom field to calculate

2. Automation - do not seem to have add calculation / computation on the Action component

 

Appreciate your help.

1 answer

1 accepted

1 vote
Answer accepted
Peter Youngman
Contributor
December 17, 2021

Hi @[deleted] 

You can use "smart values" to make a calculation and update a field value with it.

Use the "Edit issue" action to set your "duration" custom field to something like this:

{{issue.customfield_13455.diff(now).businessDays}}

The above calculates number of business days between a date in customfield_13455 and "now" (today).

You would need to change "now" in the above to your second customfield (and the first to point to the correct customfield). e.g.

{{issue.customfield_1.diff(issue.customfield_2).businessDays}}

Deleted user January 6, 2022

thank you, worked for me. :)

Deleted user January 6, 2022

hi @Peter Youngman I did make it work, however there is one issue. I changed my custom field from date time picker to number field so it would just give whole numbers instead of date time. 

The automation rule is successful, but the number field shows 0. Is there a need for me to edit anything?

Eswar Prasad
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 13, 2022

@Peter Youngman - When I write below value its giving difference in days:

{{issue.customfield_1.diff(issue.customfield_2)}}

What value should be written to get difference in 'days, months, years' between two Date fields?

Suggest an answer

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

Atlassian Community Events