Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,525
Community Members
 
Community Events
185
Community Groups

Jira Automation - Smart value: Difference between 2 timestamp custom fields in a 3rd custom field

Edited

Hello, 

Looking for some help here. 

I have researched many community solutions (by @Ravi Sagar _Sparxsys_ , @John Funk, and @Nir Haimov  but still stuck at the last hurdle.

I have the following custom field's below for which automation is working fine. These are timestamp fields.

I want to populate another custom field (number) Time to First Reponse (TTFR), which is the difference between the "Acknowledged timestamp" and "Ready status timestamp", ideally in businessDays. Hours will work too if need be.

Screen Shot 2021-11-02 at 10.04.12 AM.png

I have tested my automation conditions trying to hard code the TTFR edit issue to a number (2). and it populates fine. But when I insert the below formulae, the automation log shows success, but there is nothing outputted in the TTFR field.

-Formulae i have tried under "edit issue" 

  • Acknowledged Timestamp - customfield_14475,
  • Ready Timestamp - customfield_14474

{{issue.Customfield_14474.diff(issue.customfield_14475).hours}} 

or

{{issue.customfield_14475.diff(issue.customfield_14474]).businessDays}}

 

SCREENSHOTS - 

Screen Shot 2021-11-02 at 10.07.56 AM.png

1 answer

1 accepted

0 votes
Answer accepted
Lisa Grau
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.
Nov 02, 2021

Hi Anand,

I recreated your use case and this solution worked for me:

{{issue.Uhrzeit 1.diff(issue.Uhrzeit 2).businessDays}} -> returned the difference in days

{{issue.Uhrzeit 1.diff(issue.Uhrzeit 2)}} -> returned the difference in hours

What type is the field you are editing? I used a textfield which works fine.

"Uhrzeit 1" and "Uhrzeit 2" are my test fields.

Thanks lisa. I've tried number and now text as well. no results. I've also tried changing custom field reference from IDs to names. 

@Lisa Grau Whats your automation rule? screenshot?

@Lisa Grau  - "Uhrzeit 1" and "Uhrzeit 2" are these date time picker fields?

For me - 

customfield_14475 and issue.customfield_14474 are date time picker fields and I am trying to calculate the difference to store the result in a custom field (Text Field (single line)) field. Ive also tried a number field.

 

Here's my audit log for the automation (success) for the result custom field... Result - Time to First Response (my result custom field - text) is "None".

Screen Shot 2021-11-03 at 1.17.34 PM.png

Lisa Grau
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.
Nov 04, 2021

I'm sorry I couldn't manage to answer yesterday!

Both fields are Date Time Picker.

This is what my automation looks like:

2021-11-04 12_16_08-Project automation - Jira.png

Thank you Lisa. Magically, this worked this morning for new issues. I appreciate your responses.

Update - my automation still had issues. The first time the value for "Update for Customer" field changed, the automation for the calculation ran successfully but no results as earlier.

Interestingly, the second time the "Update for customer" field is changed, the results were successfully outputted in the screen.

My analysis (by using @Lisa Grau manual trigger idea, suggested me value change triggers were causing it. 

 

I just solved the issue by creating a manual trigger like Lisa suggested to run every night at 12 am. 

 

Thank you again. Hope this helps someone else with the same problem.

Like # people like this

Hi there,

I am also trying something similar and I was advised to look here but still can't figure it out.

 

Problem statement - We have two customfields defined: Time for Approval [in seconds] and Time for Resolution [in seconds], we are trying to do something like below but unable to get the customfield value.

 

Time to approve [customfield_XXXX] = {{issue.created.diff(now).seconds}} -- this works fine

Time to resolution = {{issue.created.diff(customfield_XXXX).seconds}} ---not working

 

Please suggest.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events