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

How can I automate logging work hours into issues as they transition to "DONE"?

Anthony Amirfar May 30, 2024

I have some metrics that I'll need to report on weekly and rather then counting on individuals to manually log work into each task I'd like for this to be automated.

I've created a rule as follows

  • Trigger: Transition to DONE from four other status
  • Action: Log Work
    • Time Spent Field = {{now.diff(issue.created).hours}}
    • Date Started Field = {{issue.created}}

The rule thinks it has worked (mostly) but does not actually log any work in the task.

logworkbug.pnglogworkrule.png

 

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
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 30, 2024

Hi @Anthony Amirfar 

First, please try adding the units of measure for hours to the end when you log that time:

{{issue.created.diff(now).hours}}h

 

If that does not help, please add the Log action (not the Log Work one again) to your rule to write out that expression.  Then re-test to observe if it has the value you expected in the audit log details.

 

Kind regards,
Bill

Anthony Amirfar May 31, 2024

Hi @Bill Sheboy ,

Thank you for your response.

I have tried both suggestions and unfortunately neither have solved my issue.

When using the "Log action" is this action supposed to be able to change fields within the issue? In this specific case my intent is to have the "Time tracking" populated with the total hours from creation to closure. Similar to when you manually log work in the issue by clicking the three dots then log work and entering "5h" for example.

The inputs I have tried for the "Log action" action are 

Time tracking is {{now.diff(issue.created).hours}}h

Log work is {{now.diff(issue.created).hours}}haaaaaaaa.png

Bill Sheboy
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 31, 2024

Please add the log action to your rule, run the rule to test it, and the post an image of the audit log details.

And, please try reversing the values as time logged cannot be negative:

{{issue.created.diff(now).hours}}h
Like Anthony Amirfar likes this
Anthony Amirfar May 31, 2024

I'm getting a positive value in the log but no update is being made to the ticket itself. Is this action designed to simply return a value in the log and not actually change the "time tracking" field in the ticket as I am intending?

Thanks again for your help!

auditlog1.pnglog work rule1.png

Bill Sheboy
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 31, 2024

Ah, you also need to Log Work after that write to the audit log :^)

Please re-add your Log Work action, with the smart value:

{{issue.created.diff(now).hours}}h

 

Writing to the audit log helps to diagnose rule problems / see progress, but does not update any issues.

Like Anthony Amirfar likes this
Anthony Amirfar May 31, 2024

That makes sense.

With that change the time is being logged into the ticket as intended!!!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events